WordPress.org

Ready to get started?Download WordPress

Forums

How are Categories in wordpress 3 menus supposed to display (5 posts)

  1. Dr Tester
    Member
    Posted 4 years ago #

    Good day everyone
    I've started to use wordpress 3, and I really like what the built in menus can do for you.
    Does anyone know how "categories" are supposed to display ?
    I am under the impression that if you add a category with say 5 posts to the menu, then the category should appear in the menu, and when you rollover that item, all the posts in the category should show up on the drop down menu,
    Am i correct or have I seriously overestimated the menu capability?

    I would appreciate if anyone can enlighten me.

  2. keesiemeijer
    moderator
    Posted 4 years ago #

    The dropdown shows only the child categories not Post or Pages. If you would have 100 posts in a category the dropdown would be very long.

  3. Dr Tester
    Member
    Posted 4 years ago #

    hmm. i understand, thank you very much for explaining.

    But is there a way to display posts automatically for a category?
    Obviously i would only select a category with 5 or so posts, hence my question

    Thanks again for any help in advance

  4. keesiemeijer
    moderator
    Posted 4 years ago #

    You can do something like this:

    <ul>
     <?php
     global $post;
     $myposts = get_posts('numberposts=5&category=1');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
     </ul>

    Where category=1 is the category ID. This gives you a list of 5 post titles in category "1" linked to the actual post.

  5. Dr Tester
    Member
    Posted 4 years ago #

    ahh some people are just so nice and helpful!
    i will for sure try that and report back!
    I am so grateful!

Topic Closed

This topic has been closed to new replies.

About this Topic