Support

Account

Home Forums General Issues Custom field from another field group inside a loop

Solved

Custom field from another field group inside a loop

  • Hello, I have two field groups: “events” and “contact data”. I have a wp query loop for “events” and I need to call inside it the “phone number” field which belongs to “contact data” field group.

    To note, there’s a value in common for both groups. In events the field “location” contains the same value as “location_contact” which is from the “contact data” group.

    I will do a scheme:
    +Loop for “events”
    ++++ “event fields”
    ++++ “phone number” from “phone number” field from “contact data” group
    +Loop closure

  • Hi @silenthill

    I would suggest that you perform multiple post type queries to grab the ACF values from the two post types. Here is a great example of how this would look.

  • Hi James!
    Yes that’s a way of solving it. Though I ended doing this.
    get_field('phone_number', 414 );
    where the number is the ID of the post, specifying it there is no need to depend on the loop to define the post.
    Thanks again!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.