[Resolved] Ajax pagination not working

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Ajax pagination not working

Tagged: ,

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #31624
    Dominik
    Participant

    Hi there,

    we are using WP show post to display all the news on a customers website.
    The news are a Custom Post Type. But the pagination does not work – Ajax is loading but no more results are displayed.

    Here’s a link to the page on our dev environment:
    https://gs.brandwerk-digital.com/news/

    What could that be?

    Thanks and best regards,
    Dominik

    #31646
    elvin
    Moderator

    Hi Dominik,

    Something seems to be blocking the AJAX request by the button. It’s returning a 404 error as shown here –
    https://share.getcloudapp.com/rRujgzoW

    This isn’t something we can address within the plugin unfortunately. A plugin(likely an overzealous security plugin) or a setting on the server must be blocking this request. Can you try asking your hosting for any permission changes?

    #31652
    Dominik
    Participant

    Hi Elvin,

    it seems that its a problem just with the custom post type.
    I have checked within our Blog (wich is built with the standard post) – pagination works perfect.

    https://gs.brandwerk-digital.com/news/ -> CPT, don’t work
    https://gs.brandwerk-digital.com/blog/ -> Standard post type, works

    Maybe it is a problem with our CPT?

    /* ******* Custom Post Type News ********* */
    if ( ! function_exists('custom_post_type_news') ) {
    
    // Register Custom Post Type News
    function custom_post_type_news() {
    
    	$labels = array(
    		'name'                  => _x( 'News', 'Post Type General Name', 'text_domain' ),
    		'singular_name'         => _x( 'News', 'Post Type Singular Name', 'text_domain' ),
    		'menu_name'             => __( 'News', 'text_domain' ),
    		'name_admin_bar'        => __( 'News', 'text_domain' ),
    		'archives'              => __( 'News Archive', 'text_domain' ),
    		'attributes'            => __( 'News Attribute', 'text_domain' ),
    		'parent_item_colon'     => __( 'Eltern News', 'text_domain' ),
    		'all_items'             => __( 'Alle News', 'text_domain' ),
    		'add_new_item'          => __( 'Neuer Newsartikel', 'text_domain' ),
    		'add_new'               => __( 'Neu', 'text_domain' ),
    		'new_item'              => __( 'Neuer Newsartikel', 'text_domain' ),
    		'edit_item'             => __( 'Newsartikel bearbeiten', 'text_domain' ),
    		'update_item'           => __( 'Newsartikel aktualisieren', 'text_domain' ),
    		'view_item'             => __( 'Zeige Newsartikel', 'text_domain' ),
    		'view_items'            => __( 'Zeige Newsartikel', 'text_domain' ),
    		'search_items'          => __( 'Suche Newsartikel', 'text_domain' ),
    		'not_found'             => __( 'Nicht gefunden', 'text_domain' ),
    		'not_found_in_trash'    => __( 'Nicht im Papierkorb gefunden', 'text_domain' ),
    		'featured_image'        => __( 'Featured Image', 'text_domain' ),
    		'set_featured_image'    => __( 'Set featured image', 'text_domain' ),
    		'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
    		'use_featured_image'    => __( 'Use as featured image', 'text_domain' ),
    		'insert_into_item'      => __( 'Insert into item', 'text_domain' ),
    		'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ),
    		'items_list'            => __( 'Items list', 'text_domain' ),
    		'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),
    		'filter_items_list'     => __( 'Filter items list', 'text_domain' ),
    	);
    	$rewrite = array(
    		'slug'                  => 'news',
    		'with_front'            => false,
    		'pages'                 => true,
    		'feeds'                 => true,
    	);
    	$args = array(
    		'label'                 => __( 'News', 'text_domain' ),
    		'description'           => __( 'Newsartikel', 'text_domain' ),
    		'labels'                => $labels,
    		'supports'              => array( 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', 'excerpt' ),
    		'hierarchical'          => false,
    		'public'                => true,
    		'show_ui'               => true,
    		'show_in_menu'          => true,
    		'show_in_rest' 					=> true,
    		'menu_position'         => 5,
    		'menu_icon'             => 'dashicons-megaphone',
    		'show_in_admin_bar'     => true,
    		'show_in_nav_menus'     => true,
    		'can_export'            => true,
    		'has_archive'           => false,
    		'exclude_from_search'   => false,
    		'publicly_queryable'    => true,
    		'query_var'             => 'post_type_news',
    		'rewrite'               => $rewrite,
    		'capability_type'       => 'page',
    	);
    	register_post_type( 'post_type_news', $args );
    
    }
    add_action( 'init', 'custom_post_type_news', 0 );
    
    }

    Thanks and best wishes,
    Dominik

    #31699
    elvin
    Moderator

    ‘has_archive’ => false,

    Can you try setting its value to “true” and see how it goes?

    #31712
    Dominik
    Participant

    has_archive is set to true but unfortunately no impact

    #31727
    elvin
    Moderator

    Strange.

    Not exactly sure why but if the CPT archive page itself has broken pagination then WPSP has no way of getting it as well.

    Any change you can try doing the CPT w/ a plugin instead? For the sake of testing things out?

    I did a test using PoDs and CPT UI and the pagination works well with any CPT created with either of these mentioned plugins. It’s likely something w/ the setting of this particular CPT, I’m just not sure which. (custom/manual CPT setup is a bit out of WPSP scope, unfortunately.)

    #31790
    Dominik
    Participant

    We have now changed from use of WPSP to the standard archive page with “load more” button from GP customizer. This works well.
    I will test all the CPT settings for the future, so we can use WPSP with our CPT and pagination in future projects.

    Thanks
    Dominik

    #31802
    elvin
    Moderator

    Thanks for letting us know. 😀

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.