• I’ve got a news and video site which I’ve integrated WordPress into. WordPress is in a ‘news/’ subfolder, while videos (using my own custom video management system) are under ‘videos/’. The sections draw from the same set of global templates and integrate really well.

    I’m trying to make a new front page for the site as a jumping off point, and for it I’d like to inlude top news from the WordPress section. Problem is, this would be called from *outside* the WordPress installation folder.

    Is there any way to poll WordPress for article info which I can use from within another PHP file without loading the entire app?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • That sounds like something your RSS feed would be idea for. Google Magpie RSS for one way to put your recent headlines outside of WP.

    Or include wp-blog-header.php and set up a loop. The advantage of using magpie isntead is it will cache your feed and keep things quick.

    you just need your index page to include the wp-blog-header.php file. In the top of your index page, just put in:

    <?php include('./news/wpblog-header.php'); ?> (or “require” – I always forget which one it is…) and make sure the path is correct. Once you’ve added that, you can use any of the WP stuff in your index page.

    a) rss feeds?
    b) a miniloop
    c) as recent posts plugin

    For b) and c) you need to make your .php file WP-aware, meaning you have to add at the top of it, before everything:

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

    I inserted that code at the top of my index.php, but I get this error when I click to see the blog:

    Warning: main(uc.html): failed to open stream: No such file or directory in /home/content/g/i/b/gibsona1/html/template.html on line 98

    Warning: main(uc.html): failed to open stream: No such file or directory in /home/content/g/i/b/gibsona1/html/template.html on line 98

    Warning: main(): Failed opening ‘uc.html’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/content/g/i/b/gibsona1/html/template.html on line 98

    Any advice? I’m still pretty new to php.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Accessing WordPress articles outside the installation folder’ is closed to new replies.