How to list posts with disabled/closed comments, with pagination?
I don’t have the time right now to work the code, but you’ll need to use pre_get_posts and filter out based upon comment_status => ‘open’.
I don’t have the time right now to work the code, but you’ll need to use pre_get_posts and filter out based upon comment_status => ‘open’.
Listing all term items alphabetically / sorting loop
The function wp_reset_query() should help http://codex.wordpress.org/Function_Reference/wp_reset_query
Ok I figured out how to add the terms to div’s class – In the code I have first the category, then the post type, then a custom taxonomy tag term assigned to it – <?php $terms = get_the_terms( $post->ID, ‘YOUR CUSTOM TAXONOMY CAT’ ); ?> <?php $post_type = get_post_type($post->ID); ?> <div class=”box<?php foreach( $terms … Read more
Custom post type conditional in loop
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
Showing sticky posts with get_posts()
Checkbox doesn’t stay checked, conten