Remove ‘dash’ from forum description
-
Is possible to remove the emdash from the forum description?
The function that generate the description: forum_description()
How can I obtain this?
Thank you in advance!
-
forum_description has an optional “before” argument
try
forum_description('');
Great!
That’s exactly what I was looking for.
Does exist a bb_function reference manual?
Thank you a lot!
Sadly not mate.
I know what you’re thinking.
Something like : https://codex.wordpress.org/Template_Tags
But no, it’s all guess work.
Yes, exactly!
Well, thank you for the information.
_ck_ – what if you wanted to use a different before character? I tried
forum_description('before=x');
but that didn’t work. I couldn’t get before or after to work.Can you explain how to use the arguments for that function please? Thanks.
function forum_description( $args = null ) {
if ( is_numeric($args) )
$args = array( 'id' => $args );
elseif ( $args && is_string($args) && false === strpos($args, '=') )
$args = array( 'before' => $args );
$defaults = array( 'id' => 0, 'before' => ' – ', 'after' => '' );
$args = wp_parse_args( $args, $defaults );
if ( $desc = apply_filters( 'forum_description', get_forum_description( $args['id'] ), $args['id'], $args ) )
echo $args['before'] . $desc . $args['after'];It seems like the relevant info is listed right there in the $defaults array, but I couldn’t stumble upon the combination to make it work.
The function is tricky in how it works, many WP/bbPress functions now use the generic $args call instead of breaking it down by field.
First it checks if what’s passed to it is a number, if so, the number is treaded as a specific forum id request.
If it’s NOT a number, then it’s checked if it’s not empty, and then if it’s a string and there’s no problem using it in an array. If so, then it’s used as the
before
element.To bypass those situations, you’d have to send it an array
Something like:
$args = array( 'id' => 1, 'before' => ' [ ', 'after' => ' ] ' );
forum_description($args);Where you could leave out any of those elements inside args if you didn’t want it, like the
id
,after
, etc.Looks to me like it should accept what chrishajer put in there, as well as an array (that’s what wp_parse_args is for).
I’ll make sure it isn’t broken somehow.
Thanks sam.
I’m running the current trunk version (checked out today) and
forum_description('');
still produces the dash. I added a space and found thatforum_description(' ');
kills the dash but puts a space into the html markup. This space doesn’t seem to affect render but, being a perfectionist and a little annoyed that forum_description does any text manipulation at all, I’d like it gone. Suggestions, solutions?I figured resurrecting this thread gave it context.
I have a 1.0.2 installation and the forum_description call looks like this by default:
<?php forum_description( array( 'before' => '<small> – ', 'after' => '</small>' ) ); ?>
Did you try modifying that array to send before and after nothing?
<?php forum_description( array( 'before' => '', 'after' => '' ) ); ?>
Worked for me, on the front page. Or are you looking to modify something else? This modified the forums listed in #forumlist at the bottom of the front page.
- You must be logged in to reply to this topic.