WordPress.org

Forums

custom Loop only showing one post instead of... (1 post)

  1. modularmule
    Member
    Posted 6 years ago #

    My Loop (Mini-Loop?) is only showing one post even after specifying 'numberposts=0' where 0 = all or max allowed on page. If I use 5, it still only shows 1 post. And it's not even the most recent post. it's the first and oldest.

    Here's the Loop code:

    <?php
        // turn off WordPress themes and include the WordPress core:
        define('WP_USE_THEMES', false);
        require($_SERVER['DOCUMENT_ROOT'] . '/blog/wp-blog-header.php');
    ?>
    		<?php
        $lastposts = get_posts('numberposts=0&category=1&orderby=date&order=DESC');
    	$content = get_the_content();
    	foreach($lastposts as $post)
        setup_postdata($post); 
    
    ?>

    what follows from there is the html markup for handling the formatting of the WP elements (the_date, storytitle, storycontent), etc...

    Please advise. Thank you!!

Topic Closed

This topic has been closed to new replies.

About this Topic