Support » Plugins » Utilize Plug-ins Outside WP directory?

  • Is there a way to utilize plug-ins on pages of my web site that are outside of the /blog/ directory? For example, show the 5 most recent post titles on our site homepage. I am already using the plug-ins within WordPress (running in /blog/ directory)…I want to extend the placement of blog related content and links to other areas of our web site. Thanks much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Yes, you can. If you have a .php file outside of the WP installation, just add this at the top of it (above everything else):

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

    and all the WP functions will be available on that page/file (including plugin functions).

    That worked perfectly! Thank you.

    I’m having a bit of trouble getting this to work. What I have is a main page, in a directory above the wordpress installation, that uses RSS feeds to pull information in from various parts of my site. However, because all of the site’s login information (Gallery2, SMF) is handled by wordpress (via bridge plugins) I’d like to provide a login form on this main page, and pass that information to wordpress. I’d also like to be able to access various information from my wordpress plugins (i.e. users online, etc).

    The problem is that even when I include wp-blog-header I can’t seem to access information on the currently logged in user. For example, the following code never returns anything, even when a user is logged in:

    <?php
    require(‘./wordpress/wp-blog-header.php’);
    global $userdata;
    get_currentuserinfo();
    echo(‘Username: ‘ . $userdata->user_login . “\n”);
    ?>

    Interestingly enough, I AM able to get information on the current number of online users (WP-UserOnline plugin) IF I also call get_header(); However, I obviously don’t want to call get_header() because that brings in a bunch of stuff from my wordpress theme which I don’t want included on the mainpage. If I don’t call get_header(), then wp-useronline always returns 0 users.

    Any ideas??

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Utilize Plug-ins Outside WP directory?’ is closed to new replies.