• I changed the name of the style.css file to style.php both in my Twentyten theme folder and my Twentyten-child folder. I added this line of code to each:

    <?php header(“Content-type: text/css”); ?>

    I also changed the header.php file to read this:

    <link rel=”stylesheet” type=”text/css” media=”all” href=”<?php bloginfo( ‘template_directory’ ); ?>/style.php” />

    Now my site seems to be reading the style.php in the Twentyten folder, but not the one in the Twentyten-child folder.

    What to do?

    Bruce

Viewing 2 replies - 1 through 2 (of 2 total)
  • WordPress I believe requires that the stylesheet be style.css and won’t work otherwise, why are you making it a php file?

    Thread Starter Bruce

    (@bnowthen)

    Yes, WordPress requires the stylesheet to have have a .css extension, but you get get around that if you want to have your .css accept variables. Here are a couple of links that show how and give a couple of examples.
    https://www.barelyfitz.com/projects/csscolor/
    https://thejimgaudet.com/articles/dynamic-css-changing-style-css-to-style-php/

    I want to dynamically change the display value of a paragraph using a Jquery routine so that every time my php code on my WordPress page loops through rows of the database and display the data, particular paragraphs have a display mode of none, but can be opened with Jquery .slidedown and then closed with Jquery .slideup. This requires that with each loop, the paragraph and triggering span have a new id which I will change by adding a -0 to the variable name and add 1 to it with each loop.

    There are other ways to do it, but this seems like the simplest. But then what do I know? I’m learning this as I go.

    Bruce

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem changing style.css to style.php’ is closed to new replies.