Home › Forums › Add-ons › Flexible Content Field › using a layout twice › Reply To: using a layout twice
Thank you for responding.
I contacted support with a ticket originally and they said it wasnt possible….
:/
So I concocted this crap.
Now I see that they are wrong and it is possible.
My issue was one of my layouts had a relationship field.
I wanted to get the relationship ID’s.
So I used
get_sub_field('relationship_field', false)
This does get the ID’s only but breaks the_row and stops the rest of sections outputting.
I got the Id’s a different way (got the whole object and then used $object->ID)
As for the file exists voodoo:
get_template_part doesnt keep variables so if you make something like this:
$var = 5;
get_template_part()....
You cant use $var inside that template.
So it’s kinda stupid.
This allows you to get a template part without losing your variables, or needing to use global.
It also uses locate_template which gets the right template if there is a child theme.
Works nicely 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.