Home › Forums › Add-ons › Repeater Field › Pulling in a repeater field, into a post object repeater field › Reply To: Pulling in a repeater field, into a post object repeater field
This seems to work, might be a bit bloated for now, but it is working properly
<?php
if(have_rows('featured_solutions')){
while (have_rows('featured_solutions')) {
the_row();
$featured_sol = get_sub_field('featured_solution');
if($featured_sol){
$fsolimage = get_field('page_thumbnail', $featured_sol->ID);
$fsollink = get_permalink($featured_sol->ID);
$fsoltitle = get_the_title($featured_sol->ID);
//$fsolsizes = get_field('product_size' , $featured_sol->ID);
//$pipesize = get_sub_field('pipe_size' , $featured_sol->ID);
//$fsoapproval = get_sub_field('approval' , $featured_sol->ID);
//$fsolapprovals = get_field('product_approval' , $featured_sol->ID , $fsoapproval[0]);
}
echo '<div class="solutionItem">
<div class="siImage" style="background-image:url(' . $fsolimage . ');"><h3 class="">' . $fsoltitle . '</h3></div>
<div class="siPad">
<div class="siCopy">
<div class="siTop">
<span>Applications</span>
<p>';
$categories = wp_get_post_categories( $featured_sol->ID , array('child_of' => 10 ));
//loop through them
foreach($categories as $c){
$cat = get_category( $c );
//get the name of the category
$cat_id = get_cat_ID( $cat->name );
//make a list item containing a link to the category
$applications = $cat->name;
echo $applications. '<br />';
}
echo '</p>
</div>
<div class="siLeft">
<span>Sizes</span>
<p>';
if(get_field('product_size' , $featured_sol->ID)){
while(has_sub_field('product_size' , $featured_sol->ID)){
echo the_sub_field('pipe_size' , $featured_sol->ID) . '<br />';
}
}
echo '</p>
</div>
<div class="siRight">
<span>Approvals</span>
<p>';
if(get_field('product_approval' , $featured_sol->ID)){
while(has_sub_field('product_approval' , $featured_sol->ID)){
echo the_sub_field('approval' , $featured_sol->ID) . '<br />';
}
}
echo '</p>
</div>
<div class="breakline"></div>
<div class="siCTA">
<div class="ctabutton primary"><a href="' . $fsollink . '">learn more</a></div>
</div>
</div>
</div>
</div> ' ;
}
}
?>
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!
📣 “ACF Chat Fridays”
— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
We’d love to see you there!
📆 Friday 3rd Feb - 3pm UTC
👉 Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.