I wrote a shortcode that I am trying to refine. It basically just gets a list of bookmarks and prints them. But I need to to add HTML around it depending on the type that is defined.
extract(shortcode_atts(array('cat' => '', 'type' => ''), $atts));
$bookmarks = get_bookmarks( array(
'orderby' => 'name',
'order' => 'ASC',
'category' => $cat
));
if (is_single()){
if($type == 'audio'){echo '<div class="sub-audio"><h6 class="sub_btn">Audio</h6>';}
if($type == 'video'){echo '<div class="sub-video"><h6 class="sub_btn">Video</h6>';}
foreach ( $bookmarks as $bookmark ) {
printf( '<a class="wpb_button_a" href="%s"><span class="wpb_button wpb_%s wpb_default2"><i class="icon-%s"> </i>%s</span></a>', $bookmark->link_url, $bookmark->link_name, $bookmark->link_name, $bookmark->link_name );
}
echo '</div>';
}
So depending on whether I define the type as either audio or video it should output HTML according to the type. But I am not sure why this isn't working.
Any help would be appreciated.
Thanks.