Support » Fixing WordPress » Using content of get_sidebar() (do_action?) in a non-WordPress page?

  • Can someone tell me what I need– if this is even possible– to display the same contents produced by get_sidebar() in a PHP document outside of my WordPress install?

    I’m trying to display the tag/category/etc links that are produced by get_sidebar() in my blog template on the front page of a site in the parent directory (I.e. the directory above /blog).

    I dug around in wp-includes/general-template.php, which then led me to wp-includes/plugin.php for do_action(), and I quickly realized it might not be so simple.

    (I hope this is OK; I’m not sure which area is best suited for this question.)

Viewing 1 replies (of 1 total)
  • I figured out the solution to this. For the benefit of others, include the following file into the non-wordpress driven file:

    include(‘blog/wp-load.php’); // change blog/ to your actual path

    Then put this where you’d like for the sidebar to appear:

    <?php get_sidebar(); ?>

    Then be sure to style the #sidebar, #searchform, and #s elements in your CSS.

    It might have been easier to just create the page in WordPress, but for various reasons I didn’t want to do that.

    Anyhow, that’s how.

    Now, I’d really love to call specific functions that correspond to each widget section (I.e. I’d like to exclude some parts of the sidebar on this particular page but have them all still appear in the blog), but I haven’t figured that out yet, and we’re using plug-ins like SimpleTags, too.

Viewing 1 replies (of 1 total)
  • The topic ‘Using content of get_sidebar() (do_action?) in a non-WordPress page?’ is closed to new replies.