Site logo

Archived topic

Pagination doesn't work with custom field

5 replies · Started by Bey on September 18, 2020

Viewing posts 1–6 of 6

Howdy -

I'm sure I'm the one doing something wrong, bear with me.
I have a custom field called "reviewer" created with the ACF plugin.

To use it, I do this in the After Entry Title GP hook.


<?php 

$reviewed_by = get_field('reviewer');

if( !empty($reviewed_by) ): ?>

	<div class="entry-meta">Reviewed by: <a href="https://kimmerseroticbookbanter.com/reviewer/<?php the_field('reviewer'); ?>"><?php the_field('reviewer'); ?></a></div>

<?php endif; ?>

My problem? If you click on next/page 2 (whatever) it just reloads the same content. Pagination doesn't work.

This is the site I'm working on: https://kimmerseroticbookbanter.com
When you click on "Jay" in the first review (after reviewed by) you get all the books he's reviewed. But you can never get past the first page.

Thanks for any pointers you can offer.

Hi there,

how is reviewer defined is there a Custom Taxonomy attached to it?

Hi - I am using ACF to create a custom field called reviewer in the builder and my code pulls it from there.

Hi there,

I'm not sure if the URL structure is set up correctly.

If "reviewer" is a custom field, it can't be in your URL like that. It would have to be a custom taxonomy in order to categorize things like /reviewer/Jay. reviewer being the custom taxonomy, and Jay being the term.

Hi sorry - I completely forgot about this.

Ok - I'm not sure how I would go about making the url correct - any suggestions? I mean it "works" - it pulls all the reviews by Jay if I set the limit per page to like... 300. But when I do that, the site is super slow because the main blog page ends up loading 300 entries, which is not ideal.

Do I edit this code?

<?php 

$reviewed_by = get_field('reviewer');

if( !empty($reviewed_by) ): ?>

	<div class="entry-meta">Reviewed by: <a href="https://kimmerseroticbookbanter.com/reviewer/<?php the_field('reviewer'); ?>"><?php the_field('reviewer'); ?></a></div>

<?php endif; ?>
This archived topic is closed to new replies.