Dr Tester
Member
Posted 1 year 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.
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.
Dr Tester
Member
Posted 1 year 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
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.
Dr Tester
Member
Posted 1 year ago #
ahh some people are just so nice and helpful!
i will for sure try that and report back!
I am so grateful!