Support » Fixing WordPress » Re-opened: How to include WordPress 3.0 code into … e.g. stylesheets

  • I don’t know why this topic has been marked as resolved and closed:
    How to include WordPress 3.0 code into the 3rd party scripts?.
    The mentioned workarounds don’t work for me.

    I need this functionality for generating a dynamic css stylesheet with global variables as described here: Accessing global variable in “CSS” (style.php).

    To sum it up a bit: The code

    define('WP_USE_THEMES', false);

    was used before to enable wp functionality in 3rd party scripts. In this special case it was possible to use wp global variables in css when added to a dynamic stylesheet, for example style.php. But since 3.0 this code doesn’t work in the same way anymore, it breaks the whole css instead.

    What is the code to call wp functionality here now?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The original author marks a topic as resolved, so he probably posted, found the answer on his own, marked it as resolved, and never came back.

    Have you tried wp-load.php instead?

    Bah, I see that was mentioned in the previously linked topic. Assuming the path was correct when you tried wp-load.php and wp-config.php I don’t know what else to try.

    I understand needing to go this route when your including WordPress stuffs inside your own custom scripts, but if the dynamic style sheet is being used for a WordPress theme it seems a bit overkill. Can’t you just take the dynamic parts of your CSS and embed them directly into the appropriate theme file? Or at least include your style.php file from within a theme file?

    The style.php is included in the theme normally, but it is not possible to use global variables there. Sure I can echo everything in the html head, but the more flexible the theme is going to be, the more code is included this way and blows up the page. I love working dynamic and using as few files and code as possible, also for performance reasons.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Re-opened: How to include WordPress 3.0 code into … e.g. stylesheets’ is closed to new replies.