Sauter la navigation

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

This support ticket is created Il y a 1 année et 4 mois. There's a good chance that you are reading advice that it now obsolete.

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.

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Nigel Il y a 1 année et 4 mois.

Auteur
Publications
#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

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+01: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.

Le sujet ‘[Fermé] Astra Theme override archive's "Display items per page" for pagination’ est fermé à de nouvelles réponses.