WordPress.org

Forums

[resolved] Deadline - 4 specific posts on a template page. (4 posts)

  1. The_ROb
    Member
    Posted 8 years ago #

    I am in need of help of some serious help. I can't create the correct loop to grab 4 specific post (not in any order) to be displayed on a template page.

    I've looked at the doc, namely:
    http://codex.wordpress.org/Function_Reference/get_post
    http://codex.wordpress.org/The_Loop

    I've also noticed the get_a_post plugins and another(can't remember the name), but they state that they can only display 1 on a page. Please help me. I have to work this out tonight. thanks

    -rob

  2. vkaryl
    Member
    Posted 8 years ago #

    Try reading the stuff in Template_Tags/query_posts - I think that may be what you need: specifically, about 2/3 down the page, this section:

    showposts=1 (you can also use showposts=3, or any number to display a limited number of posts

  3. The_ROb
    Member
    Posted 8 years ago #

    vkaryl, thanks for the link. The 'showposts' actually refers to the number of posts to display.

    However, using an example further up the page, cutting and adding code, I got it to work. Here's the the unformatted working loop for everyone:

    
     <?php query_posts('p=42'); ?>
    
     <?php while (have_posts()) : the_post(); ?>
    
     <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php the_content(__('(Read the article)')); ?>
     <?php endwhile; ?>
    

    [edit] Run this loop multipul times on the page with different '('p=ID')'.

    Thanks very much. I thought my brain was going to explode.

    -rob

  4. vkaryl
    Member
    Posted 8 years ago #

    Well, I'm glad I gave the right page, even if I didn't quite get the right area from your description!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags