Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problems overwriting defaults


  • pamhsims
    Participant

    @pamhsims

    I need to change the subscribe button text and also this “Oh bother! No forums were found here!”

    I have tried adding the feedback-no-forums.php to /mytheme/bbpress/ but its not overwriting the defaul and I can find now way to change the subscribe text.

    Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)

  • Robin W
    Moderator

    @robin-w

    try adding

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'old text' ) {
    	$translated_text = 'new text';
    	}
    if ( $translated_text == 'old text2' ) {
    	$translated_text = 'new text2';
    	}
    
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );
    

    to your functions file. The wording needs to be exact including caps and punctuation

    Functions files and child themes – explained !


    Robkk
    Moderator

    @robkk

    You can use this for custom subscribe text

    //custom text for subscribe links
    function rkk_subscribe_link() {
      $args['subscribe'] = esc_html__( 'Subscribe to this',   'rkk' );
      $args['unsubscribe'] = esc_html__( 'Unsubscribe to this',   'rkk' );
      return $args;
    }
     add_filter('bbp_before_get_forum_subscribe_link_parse_args', 'rkk_subscribe_link' );
     add_filter('bbp_before_get_topic_subscribe_link_parse_args', 'rkk_subscribe_link' );

    pamhsims
    Participant

    @pamhsims

    Thanks for that. Works great with the exception of overwriting all instances of ‘subscribe’ rather than just on the one specific button.


    Robkk
    Moderator

    @robkk

    @pamhsims

    Use this code instead for what you want

    //custom text for subscribe links
    function rkk_forum_subscribe_link() {
      $args['subscribe'] = esc_html__( 'Subscribe to this forum',   'rkk' );
      $args['unsubscribe'] = esc_html__( 'Unsubscribe to this forum',   'rkk' );
      return $args;
    }
     add_filter('bbp_before_get_forum_subscribe_link_parse_args', 'rkk_forum_subscribe_link' );
    //custom text for topic subscribe links
    function rkk_topic_subscribe_link() {
      $args['subscribe'] = esc_html__( 'Subscribe to this topic',   'rkk' );
      $args['unsubscribe'] = esc_html__( 'Unsubscribe to this topic',   'rkk' );
      return $args;
    }
     add_filter('bbp_before_get_topic_subscribe_link_parse_args', 'rkk_topic_subscribe_link' );

    kcomphlint
    Participant

    @kcomphlint

    @robkk I tried using your code, but it the topic subscribe links seem to not have any effect on the topic-level subscription links.


    Robkk
    Moderator

    @robkk

    Yeah its weird how the topic subscribe links are having issues now??


    kcomphlint
    Participant

    @kcomphlint

    According to this Trac entry, the bbp_before_get_topic_subscribe_link_parse_args function may be delayed until ver 2.7?

    https://bbpress.trac.wordpress.org/ticket/2581

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.