• Hello I am building a configurable theme for my blog and would like to use a style.css.php sheet rather than putting the code directly into the header to it can be minified.

    The problem is that even though I can add the sheet and run php in it, I cannot pick up variables or wp functions in the sheet?

    Can this be done or is there a better way to add CSS so it can be minified as I far as I am aware css/js content directly in the header will not be minified?

    Perhaps my wp_register_style code is not correct for this usage…

    wp_register_style( 'theme-customize', get_template_directory_uri() . '/css/customize.css.php',3,false,'all');
    
    wp_enqueue_style( 'theme-customize' );

    Thanks for your help!

Viewing 1 replies (of 1 total)
  • Are you trying to create a new functions file or a new CSS file?

    If you would like to create a stylesheet for your css then it needs to be called ‘style.css’ without the .php on the end. Then you can place your CSS in there (body {color: #FFF;} etc)

    Then you’ll need to edit your header.php file so that the theme will recognize the new file. Right after: <?php wp_head(); ?>
    Place the following (might need modifications, depending on your file layout):
    <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style.css" type="text/css" media="all" />

    Let me know if that works!

Viewing 1 replies (of 1 total)
  • The topic ‘style.css.php not working’ is closed to new replies.