Popular posts from this blog
Displaying Future Posts in WordPress
If you do like I do and schedule posts ahead of time (especially on the podcast), there’s a way inside of WordPress to show your readers what posts are coming up next: <?php $my_query = new WP_Query('post_status=future&order=DESC&showposts=5'); if ($my_query->have_posts()) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php the_date(); ?> - <?php the_title(); ?> <?php endwhile; } ?> This will display up to 5 “scheduled” posts wherever you drop in the code. Add a headline <h2> tag if you want to give it a title (should you want to use it as a widget). Want to see this code in action? Check the WordPulse podcast page‘s sidebar to see it working!
Set limit wp_nav_menu
<?php $pages = wp_nav_menu( array( 'container_class' => 'menu1' ,'menu'=> 'Main Navigation','theme_location' => 'menu1', 'menu_class' => 'dropdown', 'echo' =>false,'container' => false ) );?> <ul class="dropdown"> <?php $limit = 5; $pages_list = preg_replace(array('#^ ]*>#','#$#'), '', $pages); $pages_arr = explode("\n", $pages_list); for($i=0;$i<$limit;$i++){ echo $pages_arr[$i]; } ?> </ul>
Comments
Post a Comment