Creating a nav with sub nav drop-downs
-
Hello. Very new to WP, CSS and PHP here. I’m looking to create a navigation like this one in a custom template I’m making.
http://tutorials.alsacreations.com/deroulant/menu-horizontal.htmI’m thinking that I want to have the navigation display categories and then sub-pages of those categories. I figure that’s the easiest way for the user to maintain their site. If I’m wrong please do correct me 🙂
I’m wondering where do I find the code that generates the categories and the code that generates the sub-pages of those categories?
Thanks,
JD
-
Thanks for that link Ryan. It showed me how to do some further customization.
What I’m looking to do though is display the posts of a specific category in the navigation. How can I do that?
Many thanks,
JDAre you saying that you would like to have a page in navigation for a specific category (say “sports” for example) and when you click on that page link it displays all of the posts in that category. If not, give me a link to see what you mean.
I’d like the navigation to show links to every post and page on the website organized by category. I’m not a big fan of the WP summary pages that show a snippet of each post. I’d like the navigation to show the post titles so you can link directly to the content of that post.
Example:
Category 1 Link
– Post 1
– Post 2
Category 2 Link
– Post 1
– Post 2Does that make sense Ryan?
Thanks,
JDThis link might help
http://codex.wordpress.org/Creating_an_Archive_Index
And then this piece of code that I use in the sidebar (but you could use it in a page template) to get a specific category’s post titles. Hope this helps.
<?php
$posts = get_posts("category=2" . "&numberposts=5");
if( $posts ) :
?><div class="recent-posts">
<h4><a href="index.php?cat=2">Recent News »</a></h4>
<ul>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<?php
$even_odd = ( 'odd' != $even_odd ) ? 'odd' : '';
?>
<li class="<?php echo $even_odd; ?>"><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?></ul>
</div>
<?php endif; ?>
- The topic ‘Creating a nav with sub nav drop-downs’ is closed to new replies.