Hello,
I am trying to create a shortcode and am having trouble with the repeater field inside of it.
What I expect to happen:
A working return with left and right output.
What happens:
Left is working fine. On the right I am getting syntax error, unexpected 'if' (T_IF)
on the first if statement of the repeater field.
function news_single_shortcode() {
$left .= '<div class="left">
<h2>' . get_field("news-title") . '</h2>'
. get_field("news-content") .
'</div>';
$right .= '<div class="right">'
if( have_rows('news-files') ):
while ( have_rows('news-files') ) : the_row();
$file = get_sub_field('news-uploaded');
if( $file ):
'<a class="item" href="#" target="_blank">' . $file['filename'] . '</a>
</div>';
return $left . $right;
}
add_shortcode('news_single', 'news_single_shortcode');