WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Group Tags
[resolved] Change "topic" to something else? (3 posts)

  1. Jeff
    Member
    Posted 1 year ago #

    When you hover over a tag, you get a flyover like "1 topic". Is there a way to change that to something like "club" instead of "topic"? I've looked through the code and couldn't find a reference for "topic" that I could change.

    Thanks!

    http://wordpress.org/extend/plugins/buddypress-group-tags/

  2. Jeff
    Member
    Posted 1 year ago #

    OK, so after some research, I think I figured this out. You need to add one line of code to the plugin and a few more to functions.php.

    Here's what I added into functions.php:

    function my_tag_text_callback( $count ) {
    	//This function is used to replace the "topic" with "club" for the tag cloud. When you hover mouse over a tag value, it
    	//would normally say "1 topic". Now it will say "1 club".
     return sprintf( _n('%s Club', '%s Clubs', $count), number_format_i18n( $count ) );
    }

    Note: You could of course use "Group" and "Groups" like this:
    return sprintf( _n('%s Group', '%s Groups', $count), number_format_i18n( $count ) );

    Now, in the bp-group-tags.php file, go to line 260 and change it from this:
    'separator' => ' '

    to this:
    'separator' => ' ', //add a comma at the end

    Then on a new line just below 260 add the following:
    'topic_count_text_callback' => 'my_tag_text_callback'

    So you end up with lines 260 and 261 looking like this:

    'separator' => ' ',
      'topic_count_text_callback' => 'my_tag_text_callback'

    This change was based on the information found here:
    http://codex.wordpress.org/Function_Reference/wp_tag_cloud#Change_Title_Text_of_Cloud_Links

    Cheers,
    Jeff

  3. HansRuedi
    Member
    Posted 1 year ago #

    Hi Jeff,

    Thanks for this. Working perfect.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic