Thursday 19 May 2016

how to create dynmic menu in one page theme

<ul class="nav navbar-nav">
<?php
global $post;
$args= array('post_type'=>'page', 'orderby'=>'menu_order', 'posts_par_page'=>'-1','order'=>'ASC');
$myposts= get_posts($args);
foreach ($myposts as $post) :setup_postdata($post); ?>
<li class="dropdown"><a href="#<?php echo $post->post_name; ?>"><?php the_title(); ?></a></li>

                             <?php endforeach; ?>


</ul>

No comments:

Post a Comment