Custom posttype archive – pagination – Post missing / repeating
-
Hello,
I’m using a custom post type with a pagination. But some posts are repeated and some are not shown. Can’t figure out what the problem is.
Only thing I know is that there are missing and dublicated posts on the end of the page break “page 2” / “page 3” / “page 4” etc etc. And that this problem only occurse with the pagination. (show posts 9999 fixes the problem)
Like this: https://autobruins.nl/problem.jpg
You can see the seat arona is shown two times on page 4 and 5. This is wrong.The pagination on “archive-occasions.php”:
<div class="paginationholder"> <div class="paginationinnterholder"> <?php $nav = get_the_posts_pagination( array( //'mid_size' => 2, 'prev_text' => __( '<i class="fal fa-angle-left"></i>', 'textdomain' ), 'next_text' => __( '<i class="fal fa-angle-right"></i>', 'textdomain' ), 'screen_reader_text' => __( 'A' ) ) ); $nav = str_replace('<h2 class="screen-reader-text">A</h2>', '', $nav); echo $nav; ?> </div> </div>
here is my custom post type code:
function tf_post_types() { $labels = array( 'name' => 'Occasions', 'singular_name' => 'Occasion', 'menu_name' => 'Occasions', 'name_admin_bar' => 'Occasions', 'all_items' => 'Alle occasions', 'add_new' => 'Nieuwe occasion', 'add_new_item' => 'Nieuwe occasion toevoegen', 'edit_item' => 'Occasion bewerken', 'new_item' => 'Nieuwe occasion', 'view_item' => 'Occasion bekijken', 'search_items' => 'Occasion zoeken', 'not_found' => 'Geen occasions gevonden.', 'not_found_in_trash' => 'Geen occasions gevonden in de prullenbak.', 'parent_item_colon' => 'Parent Page', ); $args = array( 'labels' => $labels, 'public' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_nav_menus' => true, 'show_in_menu' => true, 'show_in_admin_bar' => true, 'has_archive' => true, 'menu_position' => 5, //'menu_icon' => 'dashicons-calendar', 'menu_icon' => '/wp-content/themes/tatof/img/assets/car-icon.svg', 'hierarchical' => false, 'rewrite' => array( 'slug' => 'occasions','with_front' => false,'feeds' => true ), // The url /customposts/ 'query_var' => true, 'can_export' => true, 'supports' => array( 'title','editor','thumbnail','revisions','excerpt','author'), 'taxonomies' => array( 'merk' ) ); register_post_type( 'occasions', $args ); } add_action( 'init', 'tf_post_types' );
The page I need help with: [log in to see the link]
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Custom posttype archive – pagination – Post missing / repeating’ is closed to new replies.