• Hi there, I’m rather new to WordPress so I apologize if this question is not appropriate for this forum.

    I’m trying to organize my blog in a different sort of way.

    Basically, in addition to having categories, I want my posts to be categorized by issue. Each issue or theme I have set up with its own page where I provide definitions, background information and other static elements. At the bottom of each of these issue pages, I would like to list the titles of the last five posts related to that issue. I was hoping to use tags for this.

    To illustrate in case that doesn’t make sense. Suppose my blog was about dogs. My categories might be grooming, feeding, walking, health, etc. My pages (and tags) are various breeds like pugs, dalmatians, poodles, etc. So if you go to the pug page, you’ll see my static page on pugs followed by a list of the last 5 pug related posts. But if you go to the grooming category, you might see posts about pugs, poodles, etc. Hope that makes sense.

    I’m using WP 2.9.2 with the latest version of the Constructor theme.

    Do I need a plugin for this?

    Any help would be appreciated.

    Thank you in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter noonespecialca

    (@noonespecialca)

    Took me all day but I mashed this together. I added this to page.php

    If you want to add a list of posts with a specified tag to a page, add a custom field called “funmytag” with a value of the tag you want to show results for. If you don’t add a custom field to a page, this section won’t be shown at all.

    <?php
    
     $funmycooltag = get_post_meta( get_the_ID(), 'funmytag', 'true' );
     if (!empty($funmycooltag)) { 
    
     $postslist = get_posts('numberposts=5&tag='.$funmycooltag);
     foreach ($postslist as $post) :
        setup_postdata($post);
     $myID = $post->ID ;
     ?> 
    
    <h5><a href="<?php echo get_permalink($myID) ?>" rel="bookmark" title="<?php the_excerpt(); ?>"><?php echo get_the_title($myID); ?></a></h5>
    
     <?php endforeach; } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘How to list last 5 posts with ___ tag’ is closed to new replies.