SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wordpress: displayings "posts" inside a page

    So I have a page I have enabled to become the "homepage" and I have also enabled comments for this page.

    At the bottom, though, I still want to display the last 5 blog postings.

    How can I do this?

    here is my code


    Code:
    <?php get_header(); ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    page related content goes here
    
    <?php comments_template(); ?>
    <?php endwhile; endif; ?>
    
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    5 recent blog postings go here
    
    <?php endwhile; ?>
    <?php endif; ?>
    Any help?

    Thanks

  2. #2
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could do something like this:

    PHP Code:
    <ul>
    <?php $posts get_posts('numberposts=5&category=8');
    foreach(
    $posts as $post) : ?>
    <li><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

  3. #3
    SitePoint Enthusiast Azmeen's Avatar
    Join Date
    Apr 2007
    Location
    Johor Bahru, Johor, Malaysia
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tyssen's method is recommended. However, you might want to remove the category definition to show the last 5 posts regardless of its category.

  4. #4
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Everyone.

    I actually did a work around by using the recent postings plugin and actually configured it to work in that spot. However, I might re-work the code to do what you recommended.

    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •