Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use wp_enqueue_style to add my stylesheet, like this:

<?php wp_enqueue_style( 'theme-style', get_template_directory_uri() . '/style.php', false, '1.0', 'all' ); ?>

It works fine BUT I need to run a Wordpress function in the style.php file. The stylesheet file does not know that the core exists.

This is what I've heard

  • It's bad to include wp-load.php.
  • It's bad to include the stylesheet directly to header.php because plugins can't find it.
  • It's bad to include the stylesheet direclty to wp_head functions because plugins can't find it.

Is there a "correct" way to do this?

share|improve this question
    
to run a wordpress function you will need to load wp-load.php which is not a good idea. If you can please explain more why you need to run a wordpress function some here might suggest you better alternative. –  Hameedullah Khan Oct 11 '11 at 8:44
    
I have a plugin that echos CSS-files in the style.php and at the same time saves them as a cached file. Depending on if I'm on localhost or not it uses the PHP-file or the cached CSS-file. –  Jens Törnell Oct 11 '11 at 10:16
add comment

1 Answer 1

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.