WordPress.org

Ready to get started?Download WordPress

Forums

Re-opened: How to include WordPress 3.0 code into ... e.g. stylesheets (3 posts)

  1. Fee
    Member
    Posted 2 years ago #

    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);
    require('./wp-blog-header.php');

    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?

  2. Big Bagel
    Member
    Posted 2 years ago #

    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.

    http://www.corvidworks.com/articles/wordpress-content-on-other-pages

    Have you tried wp-load.php instead?

    Edit:
    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?

  3. Fee
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic