Search

bbPress Showcase » bbPress Chat

  1. Null
    User has not uploaded an avatar

    member
    Joined: May '08
    Posts: 43

    offline

    Hi,

    Currently the tags are displayed in a list like:

    -tag1
    -tag2
    -tag3

    Is it also possible to show them behind each other, separated by a comma? Like:
    tag1, tag2, tag3. Perhaps with some filter?

    Kind regards,

    Null

    Posted 2 years ago #
  2. Null
    User has not uploaded an avatar

    member
    Joined: May '08
    Posts: 43

    offline

    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";
    	}
    }
    Posted 2 years ago #

RSS feed for this topic

Post a reply to “changing tags view in topic.php”

You must log in to post.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
35 users online from in the past 30 minutes. 16 bots 19 guests
6,923 views today 8,426 yesterday 16,043 peak. Most at once 50 today 62 yesterday 131 peak. Visited today: Amylawrence, guava, JeffreyCasivant, wigbuy123, gdfddfs, nandao, _ck_, summerfortun
2,288 posts in 394 topics over 66 months by 430 of 2,167 members. Latest: watchessaleus, wigbuy123, JeffreyCasivant