Categories
CMS Mastering Development Wordpress

How to disable redirect on pagination first page

When I pagin to my.site/mypage/page/1 its redirect me to my.site/mypage/, i try to disable it on (template_redirect, do_redirect_guess_404_permalink, redirect_canonical) hooks but it not help here is my pagin function function my_custom_pagination($total_page) { global $wp_query; // need an unlikely integer $url = preg_replace(‘/\?.*/’, ‘/’, get_pagenum_link(1)); $url = preg_replace(‘/(\/amp)/’, ”, $url); if (get_query_var(‘paged’)) { $paged = get_query_var(‘paged’); […]

Categories
CMS Mastering Development Wordpress

404 when I combine taxonomy filter with pagination

I have created a custom archive page and I’ve created my custom post type using CPT. I’ve managed to add pagination but I have also created a filter using custom taxonomy and when I use the filter with pagination my site is returning 404, for example, mypage/myarchive/?paged=2&color[]=red&color[]=blue Here is the code I use for pagination: […]

Categories
CMS Mastering Development Wordpress

WordPress Sub Category Archive, Show Extra Empty Page Number in Pagination

This my code for sub category archive page: <?php // the query $the_query = new WP_Query(array( ‘category__and’ => array( 2 ), ‘post_status’ => ‘publish’, ‘post_type’ => ‘post’, ‘posts_per_page’ => 12, ‘paged’ => get_query_var( ‘paged’ ), )); ?> <?php if ($the_query->have_posts()) : ?> <?php while ($the_query->have_posts()) : $the_query->the_post(); ?> //Contents Here// <?php endwhile; ?><?php wp_reset_postdata(); ?><?php […]

Categories
CMS Mastering Development Wordpress

WordPress pagination problem on merged queries

I have merged queries in search.php with custom post types. This is my scenario when user search to "math", the main query is searching in the post title, post excerpt, and post content. Now I have a "math" category but the post information is not including "math" text which exists in the math category so […]

Categories
CMS Mastering Development Wordpress

Create a page template for “top rated posts” but show full content and not just a list

Sorry upfront if I’m not explaining this clearly. I’m using WP-PostRatings and it has this function: <?php if (function_exists(‘get_most_rated’)): ?> <ul> <?php get_most_rated(); ?> </ul> <?php endif; ?> Throwing that code in a template page shows a linked list of the top posts by user ratings but it’s not showing the full content of each […]

Categories
CMS Mastering Development Wordpress

WP_query pagination on frontpage

I’m trying to make a pagination for a WP_Query on a frontpage using the paginate_links() function and following the codex (https://codex.wordpress.org/Pagination#Static_Front_Page). The pagination displays well after 3 posts (as I request it in the new WP_Query parameter) and when clicking on the ‘2’ link, it leads to the /page/2 with the next three posts correctly. […]

Categories
CMS Mastering Development Wordpress

Random order not working correctly when using default loop + $query->set

I’m trying to use orderby => rand on a custom taxonomy page, but it’s not working correctly. On other pages I use below piece of code to show my posts from a custom post type: $paged = ( get_query_var( ‘paged’ ) ) ? absint( get_query_var( ‘paged’ ) ) : 1; $args = array( ‘posts_per_page’ => […]

Categories
CMS Mastering Development Wordpress

Paging problem. url page 1 (www.miurl.com/page/1/)

I have a problem, when I am on page 2 or on any other page and I want to return to the index, the url that offers me the pagination on page 1 is the following (https://www.url.com/page/1) and I would like it to be as it usually is (https://www.url.com) El código que tengo en el […]

Categories
Mastering Development

Pagination not working while using custom query

I have a website where On the home page I show all the posts of the website but now the requirement is to show all the posts excluding 3 Categories, but when I updated my WP_Query accordingly, Now Pagination started showing posts in loop, so Right now I am showing 12 posts in one page, […]

Categories
CMS Mastering Development Wordpress

Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error

I am having trouble getting pagination working for custom taxonomy archive with the custom query. The pagination on the taxonomy archive ends up with a 404 page. I have to run a query multiple times on many areas, so I have created a method for that. Query Method /** * @param bool $post_type * @param […]