How do I paginate a get_posts() request inside another page loop (Paginating childpages)
How do I paginate a get_posts() request inside another page loop (Paginating childpages)
How do I paginate a get_posts() request inside another page loop (Paginating childpages)
Short answer, no. But that is a pretty cool feature! To so something similar in WordPress, you’d need to code some kind of iterator in PHP and have it do the logic for you. For example: $classes = array( ‘first’, ‘second’, ‘third’ ); $iteration = 0; if ( have_posts() ) : while ( have_posts() ) … Read more
Try buildin function get_users. The code should be like that: $args = array( ‘role’ => ‘editor’ ); $editors = get_users($args); foreach ($editors as $user) { echo ‘<li>’ . $user->ID . ‘</li>’; }
Modified loop-single-forum.php to work inside of a sidebar Widget, not working on some site pages
Problem getting current post tags to show in a widget
You can try something like this: $dynValue=5;//loop this many times //start of my loop for ($num=1; $num <= $dynValue; $num++){ add_action(‘add_meta_boxes’, create_function(”, ‘//some content’)); // Write the php code as if it was to put it in an echo/print instruction. // More details: http://php.net/manual/en/function.create-function.php }//end of my loop
The function wp_reset_query() should help http://codex.wordpress.org/Function_Reference/wp_reset_query
Thanks to tips given by the commentators I was able to achieve this 🙂 <?php if ( is_front_age() ){ $most_viewed_posts = new WP_Query( array(‘v_sortby’ => ‘views’, ‘v_orderby’ => ‘DESC’, ‘showposts’ => 10, ‘cat’=> 3) ); } while ( $most_viewed_posts->have_posts() ) : $most_viewed_posts->the_post(); ?> //post structure <?php wp_reset_postdata(); ?>
On single.php, fetch 2 posts created after and 2 posts created before in relation to the actual post (using menu_order)
try this <?php //global $wp_rewrite; $loop->query_vars[‘paged’] > 1 ? $current = $loop->query_vars[‘paged’] : $current = 1; $pagination = array( ‘base’ => @add_query_arg(‘page’,’%#%’), ‘format’ => ”, ‘total’ => $loop->max_num_pages, ‘current’ => 0, ‘show_all’ => true, ‘prev_next’ => true, ‘prev_text’ => __(‘« Back’), ‘next_text’ => __(‘Newxt»’), ‘type’ => ‘plain’ ); if( $wp_rewrite->using_permalinks() ) $pagination[‘base’] = user_trailingslashit( trailingslashit( … Read more