- This topic has 5 replies, 3 voices, and was last updated 5 years, 7 months ago by
Tom.
-
AuthorPosts
-
September 18, 2020 at 12:02 pm #1449121
Bey
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.
September 19, 2020 at 3:40 am #1449681David
StaffCustomer SupportHi there,
how is
reviewerdefined is there a Custom Taxonomy attached to it?September 19, 2020 at 11:43 am #1450249Bey
Hi – I am using ACF to create a custom field called reviewer in the builder and my code pulls it from there.
September 19, 2020 at 7:39 pm #1450457Tom
Lead DeveloperLead DeveloperHi 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.reviewerbeing the custom taxonomy, andJaybeing the term.October 7, 2020 at 11:32 am #1477166Bey
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; ?>October 7, 2020 at 2:58 pm #1477481Tom
Lead DeveloperLead DeveloperCheck out the “Dynamic $_GET parameters” section at the bottom here: https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
I believe that’s how you’ll end up being able to query posts by a custom field, especially if you’re already using ACF.
-
AuthorPosts
- You must be logged in to reply to this topic.