Home/Tutorial/WordPress/Add CSS in WordPress Function
Add CSS in WordPress Function 2016-12-01T09:52:18+00:00

Add CSS to WordPress Admin

get_template_directory_uri provides the path to your current theme, you simply need to add the filename to the end of the path.  admin_enqueue_scripts for adding stylesheets anywhere within WordPress.

 

Add inline style

 

<?php wp_add_inline_style( $handle, $data ); ?>

Parameters:

$handle
(string) (required) Name of the script to which to add the extra styles. Lowercase string.
Default: None
$data
(string) (required) String containing the CSS to be added.
Default: None

wp_add_inline_style allows you to print extra styling whenever a certain stylesheet is loaded. For instance suppose a plug-in or theme makes use of the class .mycolor in a stylesheet to set a background color. This can be over-ridden by a user chosen color, stored in the database by using wp_add_inline_style to print the extra styling.

 

Reff:  Codex ,  DWB