WordPress.org

Ready to get started?Download WordPress

Forums

List of tagged posts on static pages? (4 posts)

  1. kaleksic
    Member
    Posted 6 years ago #

    I would like to list posts having a certain tag on pages, something similar to author posts.

    The ideal would be to have x most recent posts with tag y and a link to the tag page listing all posts with the specified tag.

    Is there any ready made code/plug-in for this or could anyone give me a hint how to do this?

    Thanks!

  2. MichaelH
    Member
    Posted 6 years ago #

    If you use the WordPress Default 1.6 theme, you will see posts on displayed with the tags. When you click on a tag, it takes you to the tag archive automatically--that's the WordPress native ability to handle archives.

    Not sure if that answers your question so will also say that you can use the template tag, query_posts() (see the Tag Parameters and Combining Parameters sections), to present a page of posts that match your criteria.

  3. kaleksic
    Member
    Posted 6 years ago #

    Ok, thanks for the reply but it still didn't solve my problem.

    To detail a bit more what I was hoping to achieve:

    I would like to have static pages (the ones that I write, in my site e.g 'Dogs') display in the body of the page a short list of posts tagged with the page-slug (dogs). if there is no tag that corresponds with the page_slug it should just not display anything. I think it would be ok to just display the titles clickable.

    Now, since I am only semiliterate in php I don't want to spend a lot of time reinventing the wheel. I was hoping someone had already done this or could maybe point me to a plug-in that could do something like this.

  4. galveston
    Member
    Posted 6 years ago #

    Is this what you mean? This lists ALL posts with the tag=elaine, I am trying to figure out how to list, say 5 at a time and the n next>>

    elseif(is_page('20')){
    		query_posts('tag=elaine'); ?>
    		 <?php while (have_posts()) : the_post(); ?>
    		 <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent l&auml;nk till'); ?> <?php the_title(); ?>"><?php the_title(); ?></a></h2>
             <?php the_excerpt(); ?>
    		 <span class="post-cat">Skrivet:</span> <span class="post-calendar"><?php the_time('d F, Y') ?>.
             <?php the_tags(); ?>
    
    		 </span><br/><br/>
    		 <?php endwhile;?>
             <?php
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags