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

Home Forums Support [Support request] Query loop does not show the ACF code when used as a reusable in another page

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.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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!

    #2379093
    Ying
    Staff
    Customer Support

    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?

    #2379134
    Giannis

    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)

    #2379164
    Ying
    Staff
    Customer Support

    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?

    #2379188
    Giannis

    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.

    #2379225
    Ying
    Staff
    Customer Support

    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?

    #2379584
    Giannis

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

    the rock nice meme

    #2379594
    Giannis

    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.

    #2379650
    Fernando
    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

    #2379662
    Giannis

    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)

    #2380170
    David
    Staff
    Customer Support

    Hi there,

    do you have that URL stored in a Custom Field ?

    #2380215
    Giannis

    No but… that’s a pretty neat turnaround that I should have thought… I guess?

    Thanks for the idea! :p

    #2380240
    David
    Staff
    Customer Support

    Yeah, that would be the logical option 🙂

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.