Site logo

Archived topic

GP's endless load into custom query results in CPT

3 replies · Started by Jaakko Pöntinen on April 1, 2021

Viewing posts 1–4 of 4

Heya.

I have a CPT, on whichs' singular entry I have a query to get related stuff by a custom taxonomy. Adding pagination to the query is easy enough, but produces crap results in the url, not really wanting to have single entries paginated only to have the user scroll thru the entire CPT entry again to reach the paged results. So the endless load GPP offers would be ideal here.

1. How to make GPP also take note if there's a post pagination navigation when browsing a singular CPT?
2. Also: Not all pagination is created equal; what would be the structure and markup of the pagination call needed here to match what GPP expects?

Below is the query I'm using, just fyi. Thank you!


$args = array(
	'posts_per_page' => 12,
	'paged' => $paged,
	'tax_query' => array(
		array(
		'taxonomy' => 'sijainti',
		'field' => 'name',
		'terms' => $slug,
		'operator' => 'IN',
		)));

$maahaku = new WP_Query( $args );
if ($maahaku->have_posts()) :
	while ( $maahaku->have_posts() ) :
	$maahaku->the_post();
    get_template_part( 'inc/archive', get_post_type() );
	endwhile;

Hi there,

Just to confirm, are these "related posts" at the bottom of a single post? If so, our infinite scroll functionality won't work there, as it's configured for archive pages. You will likely need to implement a custom solution to the area so a full page reload isn't necessary.

Let me know :)

Heya,

Thanks :) I'll find a solution - would have been nice if I could've shoehorned GPP's functionality in! :( It would be a guarantee of quality.

I'll look for a lightweight plugin to handle this.

Resolved. All the best to you, family & co-workers!

Infinite scroll is pretty easy to set up yourself if you play with it a bit - can't get more lightweight than that :)

Thanks, you too! :)

This archived topic is closed to new replies.