Site logo

Archived topic

Query loop does not show the ACF code when used as a reusable in another page

12 replies · Started by Giannis on October 19, 2022

Viewing posts 1–13 of 13

Ok, this is a tough one, I bet nobody will find a solution.

I have a Query Loop inside an Element which is of Template type that shows in a general archive (of a custom post type). I saved this Query Loop as a reusable item. This Query Loop contains code such as [acf field="somefield"].

When this item exists in the general archive or in a custom taxonomy archive, the ACF code shows appropriately. But when I use this Query Loop item in a
random page, then the ACFs won't show!

Any ideas? I also tried to check the inherit loop box or sth but nothing happened

Ty!

Hi there,

This is a WP thing, the shortcode added to the query loop block can not pull the current post ID, it automatically fall back to the ID of the current page.

It works when in the archive environment, but it won't on a static page. The same thing would happen if you are using a WP core query loop block.

What field type and content do the shortcodes output? Can the content be pulled dynamically using the GB headline block?

It's the Advanced Custom Field field that is not showing up. No errors, no crashes. Just not showing.

Same code is showing ACF when run in an archive (custom post archive or custom taxonomy archive) but not in a single random page as a reusable block.

Job Location: [acf field="job_location"]
one example. The rest of the Query Loop's items are perfectly visible (e.g. the custom post type's title and description)

It’s the Advanced Custom Field field that is not showing up.

I know it's ACF, what is the field type? Text?

The rest of the Query Loop’s items are perfectly visible (e.g. the custom post type’s title and description)

Are they using shortcodes as well?

Yep the exactly same query loop post element . I saved it as a reusable and used it in a page but didn't work.

Yes, text field.

If it's a text field, you should be able to use a headline block to pull it directly, there's no need to use a shortcode.

Can I see the page?

...Apparently a simple dynamic headline did the job! Who are you? The WP Magistra???

the rock nice meme

Maybe you also know how to redirect people to the page that corresponds to that custom taoxnomy's archive? cause when I choose post meta as a link and then choose the corresponding meta then the href is simple "{meta}".

update: this happens cause this is a custom field not a meta that has an archive I guess. So it can't happen.

Sure!
in the link you can see what I mean.
The second link is where it should lead the dynamic heading when clicked.

the thing is that I have both a custom taxonomy and an ACF for the same info for convenience.
(but the custom post archives will be built with ACF in mind)

Hi there,

do you have that URL stored in a Custom Field ?

No but... that's a pretty neat turnaround that I should have thought... I guess?

Thanks for the idea! :p

Yeah, that would be the logical option :)

This archived topic is closed to new replies.