Support » Themes and Templates » Add PHP stylesheet to enqueue_styles in functions.php file?

  • I have a theme with custom Theme Options that is called from the stylesheet.php. It is called in the header.php file using this line of code:

    <?php get_template_part('elements/stylesheet'); ?>

    The problem is that it is being called at the very bottom of the header and anything in the enqueue_styles in the functions.php file is being loaded before the stylesheet.php file. This is causing problems with the Theme Options selections not being displayed correctly (or at all) in IE8 and IE9.

    I have tried moving the get_template_part around in the header but when I do, it causes the same styling problems in FF and Chrome.

    How can I add that stylesheet.php in the enqueue_styles? I had a developer on this and he just up and disappeared and this is beyond my scope.

    Thanks for any help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi


    Forum Moderator

    What theme are you using? Where did you download it from?

    It’s one that we are building, with the help of the developer that took off.



    Forum Moderator

    I’m not sure that <?php get_template_part('elements/stylesheet'); ?> is the best way to deal with custom CSS in a theme. Have a look at Pretty sure that theme also implements a custom CSS option and it will be doing so correctly.

    It looks completely different than our theme, and since I’m not the one that created it, I’m not sure how I would go about applying what they used in that theme to ours.

    Maybe I’m going about this the wrong way. Maybe I need a different solution than what I originally thought?

    Using the Developer Tools on IE, I noticed that even though the default background color from the style.css file was crossed out (indicating it was not being used), and the correct/custom background color from the stylesheet.php file was not being crossed out (indicating it is being used), it still displays the default color.

    So I’m confused as to why it’s happening. Is it that the load order is wrong? Or is it something else?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add PHP stylesheet to enqueue_styles in functions.php file?’ is closed to new replies.