Paginate WordPress Category Pages

paged is correct unless you’re using pretty permalinks, however, if you’re just trying to alter posts per page for categories, you should be using the pre_get_posts action, there’s no reason to use query_posts in the template: function wpa85791_category_posts_per_page( $query ) { if ( $query->is_category() && $query->is_main_query() ) $query->set( ‘posts_per_page’, 2 ); } add_action( ‘pre_get_posts’, ‘wpa85791_category_posts_per_page’ … Read more

What’s the best way to show custom post types? With page template it’s not perfect!

Refer to the Template Hierarchy Codex entry. To display the archive index page for a custom post type, use template file archive-{posttype}.php. To display a single post page for a custom post type, use template file single-{posttype}.php. For your pagination issues with a custom query loop, look for related questions on the site.

show posts from one category with comments only

To retrieve all posts from a category, while preserving the original Loop query, you create a new query like so: <?php $testimonials = new WP_Query( array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘post’, ‘posts_per_page’ => 30, // limit number of posts for which to get ALL the comments of ‘category__in’ => array( 2, 6, 18 ) … Read more

wp_query select if have comments

You might try this: add_filter( ‘posts_where’, ‘filter_where’ ); $query = new WP_Query($args); remove_filter( ‘posts_where’, ‘filter_where’ ); where function filter_where( $where=”” ) { $where .= ” AND comment_count > 0 “; return $where; } to get posts with comments.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)