WordPress.org

Ready to get started?Download WordPress

Forums

Recent posts widget not limiting posts (2 posts)

  1. kristinachilds
    Member
    Posted 2 years ago #

    i recently imported a movable type archive into a wordpress site that *was* previously working just fine. it did some strange things, but the strangest is whatever happened to the recent posts widget.

    for some reason it's not listening to the post limiter. i would like 5, but no matter what number i put in there it lists 20. here's what i've done so far to troubleshoot:

    1. disabled all plugins
    2. went in to default-widgets.php and hard-coded 5 into the post output
    3. tried hard coding '5' into post.php
    4. tried installing different widgets to see if a different query type would work

    on the latter, i installed U More Recent Posts, an ajax recent post cycle. on initial load it shows 20 posts, however when it cycles through to the 2nd page of posts it jumps back to 5. then if i navigate back to page 1 it keeps it at 5.

    i also tried deleting all widgets and putting this in sidebar.php

    <ul>
    <?php
    	$args = array( 'numberposts' => '5' );
    	$recent_posts = wp_get_recent_posts( $args );
    	foreach( $recent_posts as $recent ){
    		echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.$recent["post_title"].'" >' .   $recent["post_title"].'</a> </li> ';
    	}
    ?>
    </ul>

    i can't for the life of me figure out what happened or how to fix it. anyone care to take a crack at this?

  2. kristinachilds
    Member
    Posted 2 years ago #

    okay, i hard coded this into sidebar.php and it seems to work, however i need to get this in widget form. i still don't understand why one taxonomy would work and the other wouldn't.

    <?php
        $recent_posts = new WP_Query();
        $recent_posts->query('showposts=5');
        ?>
        <ul>
            <?php while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?>
            <li><a href=""><?php the_title(); ?></a></li>
            <?php endwhile; ?>
        </ul>

Topic Closed

This topic has been closed to new replies.

About this Topic