Advertisements

wp_admin_css

Definition:
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {}

Enqueues or directly prints a stylesheet link to the specified CSS file.
"Intelligently" decides to enqueue or to print the CSS file. If the ‘wp_print_styles’ action has *not* yet been called, the CSS file will be enqueued. If the wp_print_styles action *has* been called, the CSS link will be printed. Printing may be forced by passing TRUE as the $force_echo (second) parameter.

Parameters

  • string $file: Optional. Style handle name or file name (without “.css” extension) relative to wp-admin/. Defaults to ‘wp-admin’.
  • bool $force_echo: Optional. Force the stylesheet link to be printed rather than enqueued.

Defined filters

  • wp_admin_css
    apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file )
  • wp_admin_css
    apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" )

Source code

function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {

	global $wp_styles;

	if ( !is_a($wp_styles, 'WP_Styles') )

		$wp_styles = new WP_Styles();



	// For backward compatibility

	$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;



	if ( $wp_styles->query( $handle ) ) {

		if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue.  Print this one immediately

			wp_print_styles( $handle );

		else // Add to style queue

			wp_enqueue_style( $handle );

		return;

	}



	echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );

	if ( is_rtl() )

		echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );

}

3417

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: