WP_Styles::add_inline_style() WordPress Method

The WP_Styles::add_inline_style() method is used to add inline CSS to a registered stylesheet.

WP_Styles::add_inline_style( string $handle, string $code ) #

Adds extra CSS styles to a registered stylesheet.


Parameters

$handle

(string)(Required)The style's registered handle.

$code

(string)(Required)String containing the CSS styles to be added.


Top ↑

Return

(bool) True on success, false on failure.


Top ↑

More Information

This method adds style rules ($code) to the given stylesheet to be output as embedded style (i.e. in a <style> element).


Top ↑

Source

File: wp-includes/class.wp-styles.php

	public function add_inline_style( $handle, $code ) {
		if ( ! $code ) {
			return false;
		}

		$after = $this->get_data( $handle, 'after' );
		if ( ! $after ) {
			$after = array();
		}

		$after[] = $code;

		return $this->add_data( $handle, 'after', $after );
	}


Top ↑

Changelog

Changelog
VersionDescription
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.