• Resolved cscott5288

    (@cscott5288)


    So the recent posts widget that comes default with wordpress will only allow you to display up to 15 posts.

    Someone found a fix for this by editing widget.php but widget.php changed in the 3.0.2 update.

    I was wondering if anyone can figure out what I need to edit to display as many posts as I want? Here’s a link to the source of the new widget.php: http://pastebin.com/7X9MdYPe

    Here’s a post page of the site I have the widget on (the widget only appears on post pages). At the bottom left, in the footer, you will notice 15 links displayed of recent posts. I am trying to show ALL recent posts, not just 15.

    If I can’t use a widget, what code can I use to retrieve title links for ALL posts?

    It seems like such a simple thing. I’m surprised it’s so difficult to do with WordPress.

Viewing 6 replies - 1 through 6 (of 6 total)
  • <?php
     $postslist = get_posts('numberposts=15);
     foreach ($postslist as $post) :
        setup_postdata($post);
     ?>
     <div>
     <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
     </div>
     <?php endforeach; ?>

    You could also use a list instead of a DIV if you’d like. Just make the appropriate replacements.

    The change the number of posts that show just modify the number after numberposts=

    You can get more information by visiting http://codex.wordpress.org/Template_Tags/get_posts

    Thread Starter cscott5288

    (@cscott5288)

    Is there anything I can do within a widget? Like a text widget?

    I’d really like to not have to de-widgetize the area I currently want the links displayed.

    Thanks for the help.

    http://wordpress.org/extend/plugins/yd-recent-posts-widget/

    That plugin may be able to do what you are looking for. It can display your latest posts using a widget although I am not sure if there are any limitations as to how many posts you can display.

    May be worth checking out though.

    Thread Starter cscott5288

    (@cscott5288)

    Hmmm, that widget does not seem to work for me. It doesn’t display anything, just white space.

    the limiting code is (at least in 3.0.1) in /wp-includes/default-widgets.php

    Thread Starter cscott5288

    (@cscott5288)

    Thanks alchymyth. I think I learned that at some point but forgot.

    For anyone wondering, just remove the following lines at 542 and 543 in default-widgets.php:

    else if ( $number > 15 )
    $number = 15;

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘display more than 15 with recent posts widget’ is closed to new replies.