404 not found error on pagination

Put your code in the template file category.php. Remove all the part before the loop: once in category template, you don’t need to get the category, get the paged, run again the query with query_posts… So your category.php should simply appear like so: if ( have_posts() ) : while ( have_posts() ) : the_post(); $image … Read more

List all posts by year with pagination

Here is my approach. What I interpreted and accepted is that you need to display the year on each and every first post on each page, and also you only need to display the year on subsequent posts if the year is different than that of the first year. I did not want to use … Read more

How to display different number of posts

This can be done with a very short plugin. function posts_on_home_page( $posts_per_page ) { if ( is_home() ) return 5; return $posts_per_page; } add_filter( ‘pre_option_posts_per_page’, ‘posts_on_home_page’ ); This is actually pretty close to the Codex example for pre_option_(option_name).

Redirect to page 2 after comment

After reading a bit on regex and preg, starting from a previous example of a similar problem and testing it I was able to answer my own question. I added this function to functions.php: <?php /** Plugin Name: WPSE (#167237) Redirect after comment */ add_filter(‘comment_post_redirect’, ‘redirect_after_comment’); function redirect_after_comment($location) { return preg_replace(“/comment-page-([\d]+)\/#comment-([\d]+)/”, “2”, $location); } It’s … Read more

How to test pagination? [closed]

The homepage and all archive pages (date, category, tag, taxonomy and author pages ) uses the same default pagination functions for pagination. What this means is, the_posts_pagination works on all archive pages and the home page. The only differences on these pages is the content which is determined by the main query. As far as … Read more

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