Accessing WordPress articles outside the installation folder (5 posts)

  1. richcon
    Posted 7 years ago #

    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?


  2. Adam Brown
    Posted 7 years ago #

    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.

  3. Doodlebee
    Posted 7 years ago #

    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.

  4. moshu
    Posted 7 years ago #

    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:

  5. Anonymous
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.