Created
August 2, 2014 22:29
-
-
Save morsdyce/9e88db1eba916163cc23 to your computer and use it in GitHub Desktop.
Sub pages menu on wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($cat) && !empty($cat)) : ?> | |
<nav role="category-navigation"> | |
<a href="#" id="dropdown-menu"><?php _e('Menu', 'dwframework'); ?></a> | |
<?php | |
// Query the lasts ten category posts | |
$category_ten_last_posts = array( | |
'numberposts' => 10, | |
'cat' => $cat, | |
'orderby' => 'date', | |
'order' => 'DESC' | |
); ?> | |
<div class="menu-menu-1-container"> | |
<ul id="menu-category-1" class="menu"> | |
<?php foreach (get_posts($category_ten_last_posts) as $post) : ?> | |
<li class="menu-item menu-item-type-custom menu-item-object-custom"> | |
<a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
</div> | |
<div class="clearfix"></div> | |
</nav> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment