Reply To: ACF – Relationship Field

#17071

gteigland
Participant

As you state:

“they store serialized information as a reference to some other field/object”

is there a way to add that code into your plugin so it knows how to translate them?

This is the code i use to have them show up as text within my template file: (twig)
{% for item in post.get_field('manufacturer') %}

Here's the full php call:
<?php $manufacturer = get_field( 'manufacturer' ); ?>
<?php if ( $manufacturer ): ?>
<?php foreach ( $manufacturer as $post ): ?>
<?php setup_postdata ($post); ?>
“><?php the_title(); ?>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?

Heres a link to their documentation if that helps:

https://www.advancedcustomfields.com/resources/relationship/
https://www.advancedcustomfields.com/resources/acf-fields-relationship-result/

  • This reply was modified 6 months, 2 weeks ago by  gteigland.
  • This reply was modified 6 months, 2 weeks ago by  gteigland.
  • This reply was modified 6 months, 2 weeks ago by  gteigland.