Support » Themes and Templates » style.php not overriding style.css

style.php not overriding style.css

  • I’m currently having trouble getting my styles in the style.php to override my default style.css. The reason I’m using .php extension is because I’m grabbing user specified values through a plugin and echoing them in style.php. I’m not entirely sure if I’m doing it correctly. If someone could take a look, it would be greatly appreciated. I have provided my link and my style.php file below.

    <link rel='stylesheet' type='text/css' media='all' href="<?php bloginfo( 'stylesheet_url' ); ?>"/>
    <link rel='stylesheet' type='text/css' media='all' href="<?php get_template_directory_uri(); ?>/style.php"/>


    	$hi = ot_get_option('category_color');
    .category-label {
    	background: <?php echo $hi; ?>;

Viewing 1 replies (of 1 total)
  • Assuming you are storing the values using the Settings API, try it like this on functions.php or include Style.php on functions:

    function im_override_css() {
             <style type="text/css">
             	<?php if(  get_option( 'category_color' ) ): ?>
                 	h1 {
    	             	background: <?php echo get_option( 'category_color' ); ?>;
                 <?php endif; ?>
    add_action( 'wp_head', 'im_override_css');
Viewing 1 replies (of 1 total)
  • The topic ‘style.php not overriding style.css’ is closed to new replies.
Skip to toolbar