WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Recent Post for Page (not widget)

[Resolved] Recent Post for Page (not widget)

  • thedangerouslybeavers
    Member

    @thedangerouslybeavers

    Hey all,

    I was wondering if there was a way to display the same code for the recent posts widget on my home page. I want to be able to make my home page automatically update with the latest posts but I DONT want it on my side bar?

    Any help?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • MichaelH
    Member

    @michaelh

    There are plugins that provide tags you can add to posts or pages to display recent posts, such as: http://wordpress.org/extend/plugins/yd-recent-posts-widget/

    or you can use a get_posts structure to do that in your theme’s template file(s). See: http://www.daobydesign.com/blog/2007/07/modifying-wordpress-front-page/

    Shane G
    Member

    @shane-g

    Hi,

    Use this code in order to display recent posts:

    <?php query_posts(‘showposts=5’); ?>

    Thanks,

    Shane G.

    MichaelH
    Member

    @michaelh

    Wouldn’t using query_posts like that suggested by Shane G. I believe will reguire a wp_reset_query(); so to restore the ‘main loop’ query values?

    Shane G
    Member

    @shane-g

    Hi,

    My Code was wrapped in the format. Hence, I have posted it again here:

    <?php query_posts('showposts=5'); ?>
    <ul>
    <?php while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endwhile;?>
    </ul>

    Thanks,

    Shane G.

    mihaicoman
    Member

    @mihaicoman

    Shane G. Hey man thanks a lot for the php code. It worked perfectly on a custom made theme by me :D. Now i’m looking for archives and recent comments (not widget of course). Can you help me out?

    Best regards
    Coman Mihai

    thanks Shange G
    just what i needed!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Recent Post for Page (not widget)’ is closed to new replies.