Home › Forums › Add-ons › Repeater Field › Repeaters – Get Sub-Field Siblings › Reply To: Repeaters – Get Sub-Field Siblings
I have found a way to bodge this using CSS. It’s not pretty and it does mean looping through all the translations so if anyone knows a better way I’d be very happy to hear it. Here’s what I’m doing:
function tsltContent() {
if(!isset($_GET['tr']) || empty($_GET['tr'])) {
$finalStr = "<h2>" . get_the_title() . "</h2>";
$getallcontent = apply_filters('the_content', get_the_content());
$finalStr .= $getallcontent;
}else{
$trlang = $_GET['tr'];
$finalStr;
if(have_rows('page_translations') ):
while(have_rows('page_translations')): the_row();
$newlang = get_sub_field('choose_language');
if($trlang == $newlang) {
$markup = '<div class="show-lang">';
}else{
$markup = '<div class="hide-lang">';
}
if(have_rows('translation_elements')):
while(have_rows('translation_elements')): the_row();
$trStrTitle = get_sub_field('translated_title');
$trStrContent = get_sub_field('translated_content');
$finalStr .= $markup . "<h2>" . $trStrTitle . "</h2>" . $trStrContent . "</div>";
endwhile;
endif;
endwhile;
endif;
}
return $finalStr;
}
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.