List articles from a category in a horizontal dropdown menu
-
Hello guys!
I’m a quite rookie WordPress user, and I’ve got a question what I can not solve.
I have a website with a built in horizontal menu. I can add dropdown categories in there. When I point on it the list of sub categories appear. When I click on a sub category the related articles are listed.
What I want to do is to display the articles in the drop down menu, so when I click on the title of the article the post appears.
Are there any solution to do this?
Here is my navigation code:
<!-- NAVIGATION --> <div id="navbar"> <ul id="navcatlist"> <li<?php if(is_home() ) { ?> class="current-cat"<?php } ?>><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('description'); ?>"><?php echo $blognews["home"]; ?></a></li> <?php if ($bnews_options['enBlog'] == 1) { wp_list_categories('orderby='.$bnews_options["orderBy"].'&order='.$bnews_options["order"].'&child_of='.$bnews_options["blogID"].'&title_li=&depth=2&exclude='.$bnews_options["excludeCategories"]); } else { wp_list_categories('orderby='.$bnews_options["orderBy"].'&order='.$bnews_options["order"].'&title_li=&depth=2&exclude='.$bnews_options["excludeCategories"]); } ?> </ul> </div><div class="clear"></div> <!-- END OF NAVIGATION -->
I have already found something which almost does what I want to do, but It is not exactly what I need because this code lists the articles from a category but not in a drop down menu format, but only next to the other menus. Every article a new menu in this case. Is it possible to integrate the two codes somehow in order to appear in a drop down format?
<ul> <?php global $post; $myposts = get_posts('numberposts=5&category=1'); foreach($myposts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>
Can it be solved somehow?
Thank you very much the information in advance!
Andris from Hungary
- The topic ‘List articles from a category in a horizontal dropdown menu’ is closed to new replies.