WordPress.org

Support

Support » Plugins and Hacks » Add tagged posts to wordpress page

Add tagged posts to wordpress page

  • chris2006

    @chris2006

    Hi,

    I’m currently creating a number of wordpress informational pages, and would like to attach a number of post entries at the bottom of the page.

    Is this possible?

    Ideally i would like to attach posts from specific tags, does anyone know of any plugins that would achieve this?

    Example:

    Page about Blue Widgets
    blue widget information here etc

    Posts:
    Blue Widgets Are Fun And Cool
    New Blue Widgets Are Now Available

Viewing 5 replies - 1 through 5 (of 5 total)
  • taffeljohan

    @taffeljohan

    I don’t know of plugins for this, but it is pretty easy to put in a template, just by creating your own loop at the bottom. Something like this is all you need:

    <?php
    $myTaggedPosts = new WP_Query();
    $myTaggedPosts->query('tag=chocolate');
    ?>
    <ul>
    <?php while ($myTaggedPosts->have_posts()): $myTaggedPosts->the_post();?>
    <li><a href="<?php the_permalink();?>"><?php the_title();?></a></li>
    <?php endwhile;?>
    </ul>
    chris2006

    @chris2006

    That’s a great help thanks taffeljohan!

    what would be a good solution to achieving this for multiple pages – with multiple tags?

    Using conditionals for the pageID?

    taffeljohan

    @taffeljohan

    Sounds like a plan, if there aren’t too many. Otherwise it will be a pain to hard code everything. Otherwise you could use custom fields on the pages to store parameters (tag names, for instance).

    By the way, it should have been
    $myTaggedPosts->query_posts('tag=chocolate')
    (i left out the _posts part)

    taffeljohan

    @taffeljohan

    I take back that last correction! There is no query_posts method in WP_Query. I was right the first time.

    gr33nturk

    @gr33nturk

    Thanks. Ill give that a try at http://lime.wire-2008.com

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add tagged posts to wordpress page’ is closed to new replies.
Skip to toolbar