Skip Navigation

[Closed] Astra Theme override archive's "Display items per page" for pagination

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 11 months ago.

Author
Posts
#2679145

Hi, I've a couple of taxonomy archives with pagination. I've set 8 results per page, but it doesn't work.

The value is overridden by Astra Theme Customizing>Blog / Archive>Post Per Page setting.

It is a problem if I want to display a different number of result for the blog or other taxonomies.

Can you check it here:

/discover/antiquities-prehistoric-sites/
/wp-admin/admin.php?page=view-archives-editor&view_id=412

thanks
Umberto

#2679430

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Umberto

It appears Astra applies its pagination settings later than Toolset, thereby overriding them.

You will need to use code to disable the application of the Astra setting on the archives that you specify.

Here's a simple example to dis-apply the Astra settings on the 'event' post type archive:

/**
 * Remove Astra archive pagination setting for specified archive
 */
add_action( 'parse_tax_query', 'ts_mod_archive_pagination', 1, 1 );
function ts_mod_archive_pagination( $query ){
	
	if ( ! is_admin() && $query->is_main_query() ) {

		// Check if it is the archive page for the 'event' post type
        if ( $query->is_post_type_archive( 'event' ) ) {

            remove_action( 'parse_tax_query', 'astra_blog_post_per_page', 10, 1 );
        }
    }
}

You'll need to modify that to test for the particular archives this should apply to.

The topic ‘[Closed] Astra Theme override archive's "Display items per page" for pagination’ is closed to new replies.