Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: changing tag list view

@null

Member

Ok I have written a function to get the tags in a row, but I want to have them comma seperated, any ideas?

function bb_row_tags( $args = null ) {
$defaults = array(
'tags' => false,
'format' => 'row',
'topic' => 0,
);

$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );

if ( !$topic = get_topic( get_topic_id( $topic ) ) ) {
return false;
}

if ( !is_array( $tags ) ) {
$tags = bb_get_topic_tags( $topic->topic_id );
}

if ( !$tags ) {
return false;
}

$r = '';
switch ( strtolower( $format ) ) {
case 'row' :
default :
$args['format'] = 'row';
foreach ( $tags as $tag ) {
$r .= _bb_row_tag_item( $tag, $args );
}
break;
}
echo $r;
}

function _bb_row_tag_item( $tag, $args ) {
$url = esc_url( bb_get_tag_link( $tag ) );
$name = esc_html( bb_get_tag_name( $tag ) );
if ( 'row' == $args['format'] ) {
$id = 'tag-' . $tag->tag_id . '_' . $tag->user_id;
return "t" . '<a href="' . $url . '" rel="tag">' . $name . '</a>' . "n";
}
}

Skip to toolbar