Pagination Links – Combine WordPress pagination features for archives and search results

I am currently updating an old WordPress theme (a stand-alone theme, not a child of an official theme). While trying to build up pagination, I notice some issues where a function is created that works for both archives and search. The first snippet works well with archives (categories, loops, etc):

function pagination_bar() {
    global $wp_query;

    $total_pages = $wp_query->max_num_pages;

    if ($total_pages > 1){
        $current_page = max(1, get_query_var('paged'));

        echo paginate_links(array(
            'base'      => get_pagenum_link(1) . '%_%',
            'format'    => 'page/%#%',
            'current'   => $current_page,
            'total'     => $total_pages,
            'prev_text' => __('« Previous page'),
            'next_text' => __('Next page »'),

The problem is that when I use pages in the search results, the links are at the end (while it should be

That's why I've created a custom lookup pagination feature:

function pagination_bar_search() {
    global $wp_query;

    $total_pages = $wp_query->max_num_pages;

    if ($total_pages > 1){
        $current_page = max(1, get_query_var('paged'));

        echo paginate_links(array(
            'base'      => get_home_url() . '%_%',
            'format'    => '/page/%#%/',
            'current'   => $current_page,
            'total'     => $total_pages,
            'prev_text' => __('« Previous page'),
            'next_text' => __('Next page »'),

Both work fine, but do you have ideas on how to combine the two functions and create a function that works well for both archives and searches?

I am on the latest WordPress (5.2.3).

this is that search.php Loop function:

max_num_pages > 1)
echo 'Page ' . $paged.' of '.$wp_query->max_num_pages; 



Custom Post Types – Pagination does not work for the archive

The query works for the default blog and pages, but not for custom post archives. Did I miss something?

$paged_bottom = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
              $args_pagination_bottom  = array(
                  'format'    => '?paged=%#%',
                  'current'   => intval($paged_bottom),
                  'total'     => intval($GLOBALS('wp_query')->max_num_pages),
                  'mid_size'  => 2,
                  'prev_text' => '',
                  'next_text' => '',

              echo paginate_links($args_pagination_bottom);

I tried

public function __construct()

                  add_action( 'pre_get_posts', array($this, 'ggowl_archive_posts_per_page'),20,1 );


              public function ggowl_archive_posts_per_page( $query ) {
                  // var_dump($query);

                  if ( $query->is_archive('product') || $query->is_category() ) {
                      set_query_var('posts_per_page', 1);

This works outside the class. How can I get it up and running in class?

WordPress single page template, custom post type, page pagination order

For a while I searched for a method to page on a single page template, sorted by title (the customer likes sorting the first names of team members).

I assume that this would include a way of paginating by title or? Equalize.

The following paginates quite well by mail, not by title.

') ?>
') ?>

How do you manually page / ask for a custom post type (orderby => title) offset by the title of the post that fills in the single page template? Thank you for any help. – Why does not pagination work in custom posts in WordPress?

This is my code in WordPress


            'post_type' => 'ruko_post', 
            'orderby' => 'meta_value_num',
            'order' =>  'ASC',


$pastEvents->max_num_pages )); wp_reset_query(); ?>

SEO – How do I deal with potential duplicates or similar content when I use thumbnails with pagination?

I researched for 2 days and am still not sure how to handle this obvious but confusing issue: SEO thumbnails with potential duplicates or similar content.

I have a page (with pagination) that displays thumbnails of video images like this:


In this case, there is no duplicate content just because I show all the videos sorted in order.

Therefore, each page is indexed because it is not considered duplicate content.

But sometimes I show thumbnails of videos that might have similar data, especially when I am filtering for data, such as:




In this case, video thumbnails from 1970 and video thumbnails from the black and white category might contain duplicate or similar data, but this is not essential.

So my question is how Google handles potential duplicate or similar data when using thumbnails with pagination and some other type of filtering.

And how do I deal with it on my page? Is there something to keep in mind when dealing with this problem?

Any good articles or books about it?

Many thanks.

Does Pagination with Infinite Load Affect Search Engine Optimization?

I've developed a website in React for the frontend. I can see links on the pages NO infinitely indexed on Google. Links to those containing an infinite number of pagination pages have not yet been indexed. It is 3 weeks ago. Do I have to convert the pages to normal page breaks without loading them indefinitely?

CPT pagination on the archive page & # 39; No posts found & # 39; on / page / 2

I have an archive page for a CPT that should paginate after 6 entries. If I click on the link to get to the second page, a page will not be found. The URL is {CPT} / page / 2 and the content of the page is 404.

I used the example on to paginate.

Here is the code for the query and pagination:

                                'posts_per_page' => 6,
                                'paged' => $paged,
                                'tax_query' => array(
                                        'taxonomy' =>'project_category',
                                        'field' => 'slug',
                                        'terms' => 'current-projects'
                            $the_query = new WP_Query($args);

                            //The Loop to post each Property Article
                            if ($the_query->have_posts()) { ?>                      

have_posts() ) : $the_query->the_post(); ?>
max_num_pages); } ?>

Web Part – How can I filter a list in a view on a page without interrupting pagination?

I placed an app part on a page where I want to filter the data in the list to display it. The data must be filtered according to several conditions. I have done most of the filtering, but filtering by date range turns out to be problematic

I tried with SP designer 2013 to associate Web Parts with the list view to filter the list (source), but this solution has paused. Only one page of results could be displayed. The 2nd results page was always empty.

I also tried to manipulate the URL to query the list view (source), but the end result was similar to the first method, where the second results page was always empty

Using these two methods, I was able to query the date in a date range, but both caused the paging to fail

The enterprise search feature is probably not applicable to me because I just want to be able to search data from one list at a time. I do not want to search the entire site collection (or even the site).

What I have now is a page with Text Filters and Date Filters this can make exact matches, but what I need is to filter the data by a date range. With this method, I can navigate to the second results page, but I do not see how I can integrate a date range filter into this method.

Has anyone managed to filter data by date range and not pause the paging?