Top Nav Mutli Level
-
Hi there I am abit of a lost right now on the direction to approach
this problemMain nav will be like this
Home
Category1 ->
Sub Category
Sub Category
Post of Category1 (Not subcategory posts)
Post of Category1 (Not subcategory posts)
Category2 ->
Sub Category
Sub Category
Post of Category2 (Not subcategory posts)
Category3something along side this structure.
what I current have isHome
Category1 ->
Post of Category1
Post of Subcategory1
Sub Category ->
Post of Subcategory1
Category2
Category3Below is the code.
<?php $args=array( 'orderby' => 'name', 'order' => 'ASC',); $categories=get_categories($args); foreach($categories as $category) { if ( $category->name != "article"){ echo '<li><a href="' . get_category_link( $category->term_id ) . '" class="title" title="' . $category->name . '" >' . $category->name . '</a> <ul>'; $cat_query = new WP_Query('category_name='.$category->slug ); while ($cat_query->have_posts()) : $cat_query->the_post(); echo '<li><a href="' . get_permalink($post->ID) . '" title="' . the_title_attribute('echo=0') .'" >' . the_title('','',false) . '</a></li>'; endwhile; wp_reset_postdata(); echo '</ul> </li>'; }} ?>
tried wp list categories but it lacks the posts that are made
in the top level of the category.solutions?
- The topic ‘Top Nav Mutli Level’ is closed to new replies.