• Hi everybody,

    I would like to create such navigation where I have listed all the posts as links from a specific category. I’d also liked to control amount of posts shown per category as well as the order.

    For example like this:
    PHOTOS 1 2 3 4 5 6 7 8 9
    THINGS 1 2 3 4 5 6 7 8 9…and so on…

    Every number would be a link to a one post in Photos/Things category.

    I searched and found this:

    <!--Show posts by category-->
    <?php if (in_category('4')) : ?>
    <?php $my_query = new WP_Query('cat=4&showposts=15'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    # "><?php the_title(); ?><br />
    
    <?php endwhile; ?>
    
    <?php endif; ?>
    <!--End Show posts by category-->

    I’m not quite following what’s going on there… From what I know the in_category() should be inside a loop to work, if I put this in a loop , it multiplies all the posts (if I have three posts in a category, it shows all them three times). I’m a bit confused with this.

    Could some nice person break this down for me? I would appreciate that tremendously! Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Take a look at this plugin, it does most of that for you:
    http://www.dagondesign.com/articles/sitemap-generator-plugin-for-wordpress/

    Thread Starter hilj

    (@hilj)

    Thank you! I’ll give it a try 🙂

    Thread Starter hilj

    (@hilj)

    Hmm… I dont know if this is good for me after all.

    It shows the post name, for example like this:
    PHOTOS photos1 photos1 photos1 photos1

    I’d like a small image there or a bullet or some simple character or a number. I would need to edit the plugin.

    Can anyone still clarify the upper code? Thanks!

    hilj, look at the sidebar here and see if this is what you want.

    CyberCoder.net

    I put each post in one category ONLY, then list the Posts BY category, I think that is the same thing you want.

    Here is the code I use.

    <?php
     global $post;
     $myposts = get_posts('numberposts=7&category=8');
     foreach($myposts as $post) :
     ?>
        <li><a href=<?php the_permalink(); ?>><?php the_title(); ?></a></li>
     <?php endforeach; ?>
    Thread Starter hilj

    (@hilj)

    Thanks CyberCoder, never thought of that.

    I managed pretty easily to modify the plugin. Sorry for Dagon Design, I spoiled the plugin, hope it’s okay 🙂

    hello hilj,

    could you post the modified version of the dragondesign plugin for download? i need the same thing as you do, i found it incredible that this plugin doens’t exist yet. Displaying posts from a certain category in the sidebar is almost mandatory for anyone who uses WordPress as a content management system.

    hope to hear from you!
    gert.leroy [@] martialarts.be
    thanks !

    hilj, will this plugin put my posts in the sidebar?
    is it created for the sidebar?

    hilj, no need for that anymore,
    i found the perfect plugin for me here:
    http://wordpress.org/extend/plugins/category-posts/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Howto create a link list of posts in specific category?’ is closed to new replies.