Forums

Recent post externally (3 posts)

  1. Geoserv
    Member
    Posted 2 weeks ago #

    Using version 2.8.5

    I am trying to display my recent blog posts on a non-Wordpress page.

    I tried using:

    <?php
    require(‘./wp-blog-header.php’); // alter to path to wp-blog-header.php script on your site
    ?>
    <!– if you want to have a title graphic it goes here –>
    
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    
            # <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a> <small> in <?php the_category(’, ‘) ?> &nbsp;</small><small><?php the_time(’m-d-Y’); ?> <?php the_time(’g:i a’); ?></small><br />
    
    <?php endforeach; else: ?>
    <!– put what you want here when there are no posts –>
    <?php endif; ?>

    but it doesn't display anything.

    Is there something else that will work?

    Thanks.

  2. MichaelH
    moderator
    Posted 2 weeks ago #

  3. Geoserv
    Member
    Posted 1 week ago #

    I tried that method and received the following error:

    Fatal error: Call to undefined method stdClass::set_prefix() in /path/to/my/wp-settings.php on line 268

    Not sure why it would be showing wp-settings.php though.

    Any ideas?

Reply

You must log in to post.

About this Topic

Tags