Hello,
+1 for this question, i am looking for the solution too…
+1 for this
ACF Pro with WPML translation of $field[‘label’] needed.
Hello, this solved my problem:
<?php
if( have_rows('repeater_field_name') )
{
$field_key = "repeater_field_number";
$field = get_field_object($field_key);
foreach($field['value'] as $value)
{
if(!empty($value['repeater_subfield_name']))
{
$not_empty = true;
break;
}
}
if($not_empty == true)
{
echo '<h2>' . $field['label'] . '</h2>';
}
echo '<ul>';
while ( have_rows('repeater_field_name') )
{
the_row();
$subfield = get_sub_field('repeater_subfield_name');
if( !empty($subfield) )
{
echo '<li>' . $subfield . '</li>';
}
}
echo '</ul>';
}
?>
Uff,
i tried, but no success.
I’ll try to explain it on example again. The result is:
<h2>Title</h2>
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
If the “li” (= repeater sub field) not exists, list not exists, “h2” (= repeater field label) is not displayed. i will be greatfull for any help with this lines of code.
Hello,
“Title” is written in code but it is the same as label of repeater field.
Sorry,
title is hidden even if the subfields are not empty. Any ideas?
Thanks a lot.