Why is my pagination showing up?

post_count property of query object will hold amount of posts queried. Note that this is not often used and it is more common to display such elements by conditional logic (is_singular(), is_archive(), etc) or on template level. PS query_posts() is evil and should not be used

get_next_posts_link() stops displaying at page 4

I don’t know where $era_opts comes from but a filter on pre_get_posts should do this and preserve your pagination. function era_blog_cats_wpse_103587($qry) { if ($qry->is_page(‘your-page’) && is_main_query()) { $era_opts = get_option(‘era_opts’); // assuming that era_opts are options $blogcats = $era_opts[‘era_opts_blog_thecats’]; if(!empty($era_opts[‘era_opts_blog_thecats’])) { $qry->set(‘category__in’, $blogcats); } } } add_action(‘pre_get_posts’,’era_blog_cats_wpse_103587′); I made several assumptions about your data, but … Read more

Pagination posts. Url format

Your rewrite rule format is not correct. The $rewrite argument must point to index.php with query vars set so WordPress can create the default query: add_action( ‘init’, ‘wpa103850_init’ ); function wpa103850_init() { add_rewrite_rule( ‘^([^/]+)([0-9]{1,2}).htm$’, ‘index.php?name=$matches[1]&page=$matches[2]’, ‘top’ ); } However, this will still not work correctly, due to the canonical redirect. WordPress wants to enforce a … Read more

pagination for blog landing page

This works for me with no 404s <?php $args = array ( ‘posts_per_page’ => 5 , ‘paged’ => $paged, ‘ignore_sticky_posts’ => true ); $blog_query = new WP_Query($args); if ( $blog_query->max_num_pages > 1 ) { next_posts_link(‘&larr; Older posts’, $blog_query->max_num_pages); previous_posts_link(‘Newer posts &rarr;’, $blog_query->max_num_pages); } while ( $blog_query->have_posts() ) { $blog_query->the_post(); // STUFF } if ( $blog_query->max_num_pages … Read more

One post on frontpage and an archive page

Alter the main query for the front/home page with is_front_page() and/or is_home(), like shown below: add_action(‘pre_get_posts’,’wpse104878_alter_main_query’); function wpse104878_alter_main_query($query){ if ( is_admin() || ! $query->is_main_query() ) { return; } if( $query->is_main_query() && is_front_page() || is_home() ){ $query->query_vars[‘posts_per_page’] = ‘1’; } } The archive page should work, if underscore starter theme has an template for it. You … Read more

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