Getting pagination for second loop to work on single.php

Here’s a working example of a secondary loop with pagination that can be used on singular posts. WP_Query is typically a better way to go than query_posts(). Your permalink settings shouldn’t be a factor here. <?php $my_query = new WP_Query( [ ‘posts_per_page’ => 3, ‘paged’ => ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) … Read more

Why am I getting a 404 on anything past page 1 of my query?

So, it turns out my hunch was correct and the solution is to add some rewrite rules. Here’s what I added: function owr_blog_rewrite( $rules ) { return [ ‘notes/topic/([^/]+)/?$’ => ‘topic=$matches[1]’, ‘notes/topic/([^/]+)/page/([0-9]+)/?$’ => ‘topic=$matches[1]&paged=$matches[2]’, ] + $rules; } add_filter( ‘rewrite_rules_array’, ‘owr_blog_rewrite’ ); Everything works as expected now

wordpress Next/Previous post in same category not working

I use the following code to Displays Next/Previous link in same posts category and work correctly for me. <?php get_template_part( ‘content’, get_post_format() ); // Previous/next post navigation. previous_post_link(‘%link”https://wordpress.stackexchange.com/questions/344307/,”Before’, true ); next_post_link( ‘%link”https://wordpress.stackexchange.com/questions/344307/,”Next’, true ); ?> And For CSS Styling the “%link” Element I use this code in my functions.php file. /////Next/Prev post style add_filter(‘next_post_link”https://wordpress.stackexchange.com/questions/344307/,”next_post_link_attributes’); add_filter(‘previous_post_link”https://wordpress.stackexchange.com/questions/344307/,”previous_post_link_attributes’); … Read more

In pagination, change link for page 1 to homepage

You can do a simple str_replace( ‘/page/1/’, “https://wordpress.stackexchange.com/”, $string ) on the results generated by paginate_links() to get rid of /page/1/ which appears on the first page link as well as the Prev link (when it points to the first page). Here’s a full (tested) example: /** * Numeric pagination via WP core function paginate_links(). … Read more

Having issues with wordpress pagination with multiple categories

I did more research and found a plugin that corrects the pagination issues with multiple categories. To summarize, I am using using a plugin called WordPress Category Archive – www.wordpress.org/extend/plugins/wp-category-archive/ to display my category specific archive. There were some issues with pagination due to the year/month being included in the url. The Solution: A plugin … Read more

Getting 404 on taxonomy page

I’ve solved this for myself with rewrite rule. The story: I have “piece” custom post type, taxonomy “media_tag” with “m_audio” term and taxonomy “genre_tag” with “g_sacred”, “g_folk” etc. And I want to have an URL like /piece/audio/<genre> to access archives. So, now I have in my functions.php: add_filter( ‘rewrite_rules_array’, ‘my_insert_rewrite_rules’ ); function my_insert_rewrite_rules( $rules ) … Read more

How to let crawlers search paginated comments?

The reason of why Google doesn’t index paginated comments is because of an issue with the canonical URL in your header. You can learn more about the reason behind this in a comprehensive question that I posted earlier. There is an excellent solution posted there for paginated post pages. Now, for Google to index comment … Read more

Show next / previous text (button) all the time

I have no doubt that Suyash Jain’s solution above is a good one, possibly even the optimal one, and certainly more elegant as a piece of programming than what I am about to propose. However, it strikes me that there is a very simple way to add the desired elements before and after the links … Read more

paginate_links WP function

So the purpose of the function is not that hard: generate a set of URLs of a total size with current page and some pretty parts. The issue is that the way URL is configured is quite… original and documentation doesn’t quite describe what happens accurately. The documentation implies that these are default base and … Read more