Tuesday, August 16, 2022
HomeWordPress DevelopmentPagination don’t checklist all entries on Index.php

Pagination don’t checklist all entries on Index.php


Pagination works good on pages however not on the Index.php
Drawback: It doesn’t checklist all entries and the Rely for Entries past settings >> studying interferes. Relying from what I setting the Rely, Entries lacking or it checklist an excessive amount of empty pages within the Pagination-list on the finish…

That is what I did:

if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
elseif ( get_query_var( 'web page' ) ) { $paged = get_query_var( 'web page' ); }
else { $paged = 1; }
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
  'posts_per_page' => 4 ,
  'category_name'=> 'Allgemein',
  'post_status' => 'publish, future',
  'order'=> 'DEC',
  'orderby'=> 'date',
  'paged'=> $paged
);

$the_query = new WP_Query( $args ); 
$myposts = get_posts( $args );
foreach ($myposts as $submit) : setup_postdata($submit);?>
<?php the_content(); ?> <?php endforeach; ?>

<div><?php the_posts_pagination( array(
    'mid_size' => 4,
     
    'prev_text' => __( '←', 'textdomain' ),
    'next_text' => __( '→', 'textdomain' ),
) ); ?></div>```

Thanks for any assist & resolution

PS: The post_status future will likely be proven by utilizing a operate “show_future_posts”, as I need to have a particular Entry at all times first. 

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments