Page not found when clicking on pagination tab

First thing: Category archives default to using this permalink/URL structure: http://example.com/category/<category slug>/ (for page #1) http://example.com/category/<category slug>/page/<page number>/ (for page #2, #3, and so on) So when you visit http://example.com/category/accessories/page/2/, WordPress will automatically make a call to WP_Query and the parameters being used are retrieved from the current page URL: WP_Query( array( ‘category_name’ => ‘accessories’, … Read more

How to get an array of years from all of the search results, and use it to filter by year the paginated loop?

This is really interesting one! I’ve tried to solve this, and here is what I ended up with. With a pure SQL, we have an ability to get all distinct years of all our posts with the following SQL request (recipe founded here): SELECT DISTINCT YEAR(wp_posts.post_date) FROM wp_posts getting something like this: mysql> SELECT DISTINCT … Read more

Pagination of a WP_Query Loop in a child-page page template

Glad that you managed to figure out a solution, which yes, does work. But you could make it more selectively, i.e. target just the specific pages, by using is_single( ‘<parent slug>/<child slug>’ ), e.g. is_single( ‘family-law/success-stories’ ) in your case. Secondly, it’s not exactly the redirect_canonical hook which caused the (301) redirect on singular paginated … Read more

Broken category pagination

Try creating a new instance of WP_Query and at the end use wp_reset_query(); like this: <?php $my_query = new WP_Query(); $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $my_query->query(‘cat=”. $id .”&posts_per_page=4&paged=’.$paged); while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php get_the_content() ?> <?php endwhile; ?> <?php if ( $my_query->max_num_pages > 1 ) : ?> <?php previous_posts_link( __( ‘Previous’, ‘themename’ … Read more

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