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 directly to wp_head functions because plugins can’t find it.

Is there a “correct” way to do this?

1 Answer
1

Look at the answers of these questions:

  1. How do I add CSS options to my plugin without using inline styles?
  2. Best way of adding CSS which can be manipulated by the user via theme option panels?
  3. Best practices for a Style/CSS based theme options page?

Leave a Reply

Your email address will not be published. Required fields are marked *