Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I've adjusted the code added to "Custom Code" section as given under:
function func_add_video_to_slider( $atts ) {
$i=0;
// Attributes
$atts = shortcode_atts(
array(
'slug' => '',
),
$atts
);
$term_meta = types_render_termmeta('video-category',array('output'=>'raw','separator'=>","));
$term_meta = explode(",",$term_meta);
$str = '';
foreach($term_meta as $k=>$v):
if(!empty($v)) {
$i = $i+1;
$unique_slug = 'player_'.$atts['slug']."_".$i;
$str = $str.'<li>';
$str = $str.'<iframe id="'.$unique_slug.'" src="'.$v.'?rel=0&player_id='.$unique_slug.'" width="100%" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
$str = $str.'</li>';
}
endforeach;
return $str;
}
add_shortcode( 'add_video_to_slider', 'func_add_video_to_slider' );
Can you please confirm it works as expected now:
- hidden link
Now it is no longer displayed, thanks.
What is the meaning of the variables $k=>$v? is to give it a more descriptive name.
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
$k means key and $v means value.
You can change it as required and glad to know that solution I shared help you to resolve your issue. You're welcome to mark resolve this ticket.