Skip to:
Content
Pages
Categories
Search
Top
Bottom

Set default topic title to max 70 instead of 80

  • I was searching for an option to set the max topic length to 70 instead of default 80.

    Now I think I’ve found the code inside the (Core files) bbp-core-options.php but I can’t change the core files because it will be overwritten when bbPRess updates.

    So how could I place a filter? inside my functions.php to do this?

    Just like this? (copy-/paste)

    function bbp_title_max_length( $default = '70' ) {

    echo bbp_get_title_max_length( $default );

    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • function bbp_title_max_length( $default = ’70’ ) {

    echo bbp_get_title_max_length( $default );

    }

    I am looking for the way to reduce the topic size too. 80 characters generates large ugly URLs. The above solution is not working. Would be cool if someone could help.

    There is a filter in place you can use to tweak this, bbp_get_title_max_length

    See bbp-core-options.php around line 370 or so.


    o.m.j
    Participant

    @omj-1

    sorry to bump such a old topic, but can someone show the specifc code to add to child theme functions.php? still learning here…

    I tried adding this to functions, but produced an error…

    function bbp_title_max_length( $default = 90 ) {
    	echo bbp_get_title_max_length( $default );
    }
    	/**
    	 * Return the maximum length of a title
    	 *
    	 * @since bbPress (r3246)
    	 * @param $default bool Optional. Default value 90
    	 * @uses get_option() To get the maximum title length
    	 * @return int Is anonymous posting allowed?
    	 */
    	function bbp_get_title_max_length( $default = 90 ) {
    		return (int) apply_filters( 'bbp_get_title_max_length', (int) get_option( '_bbp_title_max_length', $default ) );
    	}

    thx!


    Robkk
    Moderator

    @robkk

    Try this php code snippet. Add it to your child themes functions.php file or in a functionality plugin that can hold custom php code snipppets.

    add_filter ('bbp_get_title_max_length','rkk_change_title') ;
    
    Function rkk_change_title ($default) {
    $default=90 ;
    return $default ;
    }

    o.m.j
    Participant

    @omj-1

    thx Rob, that worked! I understand what u did, but I guess I was confused by Jareds post that stated there was already a filter in options.php for this.

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