Skip Navigation

Custom archive pagination broken by Astra theme

Open

Symptoms

If you create a custom archive with Toolset and include pagination, e.g. to show 4 posts at a time, that setting will be overridden by the Astra theme pagination settings.

Workaround

You can add the following code snippet (e.g. at Toolset > Settings > Custom Code) to prevent Astra from overriding the pagination settings.

You need to edit which post types the solution should be applied to.


/**
* Exclude specified post type archives from Astra pagination
*/
add_filter( 'astra_blog_post_per_page_exclusions', function( $post_types ){

// array of post type slugs with custom archives to apply this workaround to
$custom_archives = array( 'project', 'task', 'event' );

$exclusions = array_merge( $post_types, $custom_archives );

return $exclusions;
} );

Leave
a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>