• Hi guys, to the point, currently I’m working on my own news management script. And coz of my curiousity, I want to make one variant of my script to be WordPress Styled one (not the code, but the way how the script works). May I do that? And may I use some WP theme in it?

    Thanks 🙂

Viewing 1 replies (of 1 total)
  • I’m not completely sure about your question, but if you’re *specifically* asking if you can use the theming features in WordPress in other PHP, non-WP scripts and documents, the answer is “maybe”.

    If your script is not tied to another database connection (or the connection can be switched off and on as required), all you need is to place the following in the PHP document to access any WordPress feature, including theming:

    <?php
    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');
    ?>

    Note the define for the WP_USE_THEMES constant. Setting it to true overrides the functionality in your page/script and just passes management to the active theme (not what you want), so here it’s set to false so you can manually include theme elements (as in get_header(), get_sidebar() and get_footer()). You can also leave out the define for the same effect.

    If for whatever reason you’re unable to WordPress-enable a PHP file you could use PHP includes to insert theme templates, but any WP functions within them would fail to work.

Viewing 1 replies (of 1 total)
  • The topic ‘Using WP themes in non-WP site/script’ is closed to new replies.