Home › Forums › Support › Query loop does not show the ACF code when used as a reusable in another page
- This topic has 12 replies, 4 voices, and was last updated 5 months ago by
David.
-
AuthorPosts
-
October 19, 2022 at 9:27 am #2379003
Giannis
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!
October 19, 2022 at 10:57 am #2379093Ying
StaffCustomer SupportHi 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?
October 19, 2022 at 11:32 am #2379134Giannis
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)October 19, 2022 at 12:14 pm #2379164Ying
StaffCustomer SupportIt’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?
October 19, 2022 at 12:50 pm #2379188Giannis
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.
October 19, 2022 at 1:34 pm #2379225Ying
StaffCustomer SupportIf 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?
October 19, 2022 at 11:52 pm #2379584Giannis
…Apparently a simple dynamic headline did the job! Who are you? The WP Magistra???
October 20, 2022 at 12:16 am #2379594Giannis
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.
October 20, 2022 at 1:04 am #2379650Fernando Customer Support
Hi Giannis,
Can you provide the link where we can find this Headline your adding?
You may use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
October 20, 2022 at 1:16 am #2379662Giannis
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)October 20, 2022 at 8:07 am #2380170David
StaffCustomer SupportHi there,
do you have that URL stored in a Custom Field ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 20, 2022 at 8:51 am #2380215Giannis
No but… that’s a pretty neat turnaround that I should have thought… I guess?
Thanks for the idea! :p
October 20, 2022 at 9:14 am #2380240David
StaffCustomer SupportYeah, that would be the logical option 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.