Assign path to a variable and use in wp_enqueue_style
-
Hi,
I use this in functions.php
if ( !function_exists( 'theme_scripts' ) ) { $get_sitestyle = array("brown", "default", "green", "gray", "red"); $stylepath = get_template_directory_uri() . '/' . $get_sitestyle[of_get_option('of_alt_stylesheet')] . '.css'; function theme_scripts() { wp_enqueue_style('style', get_stylesheet_uri(), false); wp_enqueue_style('color-scheme', $stylepath); some javascripts.... } if (!is_admin()) { add_action( 'wp_print_scripts', 'theme_scripts' ); } }
When i echo $stylepath, it displays correct path with no problem, but when using it in wp_enqueue_style -> it won’t print the path to site header.
Anyone knows how do i fix it?
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Assign path to a variable and use in wp_enqueue_style’ is closed to new replies.