Home › Forums › Front-end Issues › get the feature img from post objects › Reply To: get the feature img from post objects
Hi @astrixoblix, it works.
Thank u and @elliot. And I wanna go farther. As the image shown in my first post, I want to show 3 related produces. Now I repeat the code 3 times.
$related_1 =
...
$related_2 =
...
$related_3 =
...
is it stupid? Any better idea?
Here are the codes generated by ACF:
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => 'acf_releated-products',
'title' => 'Releated Products',
'fields' => array (
array (
'key' => 'field_5296d411901eb',
'label' => '1st related product',
'name' => '1_related_product',
'type' => 'post_object',
'post_type' => array (
0 => 'product',
),
'taxonomy' => array (
0 => 'product_category:213',
),
'allow_null' => 1,
'multiple' => 0,
),
array (
'key' => 'field_5296d53cf9d3e',
'label' => '2nd related product',
'name' => '2_related_product',
'type' => 'post_object',
'post_type' => array (
0 => 'product',
),
'taxonomy' => array (
0 => 'product_category:213',
),
'allow_null' => 1,
'multiple' => 0,
)
...
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.