Hi Everybody. I have a problem. My shortcodes available custom colors etc. I need create inline css lines after my 'main' handler.
functions.php
function push_dfl_site_style() {
wp_enqueue_style('main', get_stylesheet_uri());
}
add_action('get_header', 'push_dfl_site_style');
a example shortcode
function push_dfl_columns($atts, $content = null, $tag) {
extract(shortcode_atts(array(
'class' => ''
), $atts ));
global $wp_styles;
$wp_styles->add_inline_style('main', 'body {background-color: "red"}');
$wp_styles->enqueue(array('main'));
bla bla.....
}
This not working
I try another lines
a example shortcode
function push_dfl_columns($atts, $content = null, $tag) {
extract(shortcode_atts(array(
'class' => ''
), $atts ));
function my_styles_method() {
$custom_css = "
body{
background-color: 'red';
}";
wp_add_inline_style( 'main', $custom_css );
}
add_action( 'wp_enqueue_scripts', 'my_styles_method' );
bla bla.....
}
I get this error.
Fatal error: Cannot redeclare my_styles_method() (previously declared in.....
I need custom inline styles after my 'main' handler or in head tag.
Thanks for reading my problem. I hope you give me a advice :)