WordPress.org

Ready to get started?Download WordPress

Forums

Calling WordPress PHP functions elsewhere on site (4 posts)

  1. dazburn
    Member
    Posted 8 years ago #

    Hi all,

    Quick question. My WordPress installation resides at http://www.janet-love.com/news

    However, other files reside in the root of http://www.janet-love.com and also subdirectories of the site. Basically I have a script in http://www.janet-love.com/scriptname/subdirectory let's say. I can customise the header and footer of that script as well to integrate with the site layout.

    However, I want to be able to call on WordPress PHP (such as the calendar), the sidebar etc, so that they appear on that page too.

    Obviously I can just insert <?php get_sidebar(); ?> but that doesn't get processed if the files aren't in the WordPress directory. And before you ask...this script is too complicated to integrate into a WordPress page.

    How do I do that? Hope I've made myself clear as I appreciate it's a tricky situation to explain.

    Any help would be much appreciated!

  2. Mark (podz)
    Support Maven
    Posted 8 years ago #

    It's easy :)

    First, the other pages must be .php but you probably know that.

    Second, you need wp-blog-header.php as that is the file that does all the work. So if you include that in your header all will be good

    <?php include('path/to/wp-blog-header.php'); ?>

  3. WPChina
    Member
    Posted 8 years ago #

    I struggled with this problem for a loooooong time. See this post for an example of exactly what you need to add:
    http://wordpress.org/support/topic/60829?replies=7

  4. dazburn
    Member
    Posted 8 years ago #

    thank you so much!

    one more quetsion tho...i also use the 4images RANDOM image function and it poses a problem for some reason...look at http://www.janet-love.com/mail/signup

    any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic