@@ 255-268 (lines=14) @@ | ||
252 | * @param string $code String containing the CSS styles to be added. |
|
253 | * @return bool True on success, false on failure. |
|
254 | */ |
|
255 | public function add_inline_style( $handle, $code ) { |
|
256 | if ( ! $code ) { |
|
257 | return false; |
|
258 | } |
|
259 | ||
260 | $after = $this->get_data( $handle, 'after' ); |
|
261 | if ( ! $after ) { |
|
262 | $after = array(); |
|
263 | } |
|
264 | ||
265 | $after[] = $code; |
|
266 | ||
267 | return $this->add_data( $handle, 'after', $after ); |
|
268 | } |
|
269 | ||
270 | /** |
|
271 | * Prints extra CSS styles of a registered stylesheet. |
@@ 379-392 (lines=14) @@ | ||
376 | * or after. Default 'after'. |
|
377 | * @return bool True on success, false on failure. |
|
378 | */ |
|
379 | public function add_inline_script( $handle, $data, $position = 'after' ) { |
|
380 | if ( ! $data ) { |
|
381 | return false; |
|
382 | } |
|
383 | ||
384 | if ( 'after' !== $position ) { |
|
385 | $position = 'before'; |
|
386 | } |
|
387 | ||
388 | $script = (array) $this->get_data( $handle, $position ); |
|
389 | $script[] = $data; |
|
390 | ||
391 | return $this->add_data( $handle, $position, $script ); |
|
392 | } |
|
393 | ||
394 | /** |
|
395 | * Prints inline scripts registered for a specific handle. |