CrankBerry Blog Title

No Comments

Having WordPress menu elements on non-WordPress pages

So you have a WordPress blog but you're also creating pages not through WordPress. You're thinking about how to incorporate your categories menu, archive menu and other elements into the other pages you're making. Well it is very simple and I'll show you exactly how.


  • Pages must be in PHP
  • Pages must be on the same server

If you've met the requirements then you are half way there. Next thing you need to do is open up the file in which you would like to incorporate the elements in. At the top you just need to add the these two codes:

define('WP_USE_THEMES', false);


Now the second line: require('wp-blog-header.php'); you'll have to have the actual path to the file. The file wp-blog-header.php is located in the root WordPress folder, so guide your file to the right path.

Calling the Elements

Now you can call the elements on the page by throwing the following code in your page:

<?php wp_register(" , "); ?> //Registration
<?php wp_loginout(); ?> //Logout
<?php wp_get_archives('type=monthly&format=none'); ?> //Archives
<?php wp_list_categories('style=none&show_count=1&title_li=<h2>Categories</h2>'); ?> //Categories

There you have it, now you can add all the menu elements on non-WordPress pages.

This entry was posted on Thursday, October 8th, 2009 at 8:02 pm and is filed under WordPress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

Spam protection by WP Captcha-Free