WordPress.org

Ready to get started?Download WordPress

Forums

Post Author Box
Line-breaks in Author's Description (5 posts)

  1. burkartstudios
    Member
    Posted 3 years ago #

    I've found it useful to edit line 328 in post-author-box.php as follows:

    from

    $description = $user->description ;

    to

    $description = nl2br( $user->description );

    This will translate carriage returns into br tags making longer descriptions more readable.

    Thanks for the great plug-in!

    http://wordpress.org/extend/plugins/post-author-box/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 3 years ago #

    Thankfully, there's a better way for doing that than editing the core of the plugin (which you should never do because then it's more of a pain to upgrade). At line 357 in v1.1, there's a filter you can use to change the values of the description token. To achieve the same effect, you might do something like this:

    /**
     * db_filter_values()
     * Replace the default values with ones better suited
     */
    function db_filter_values( $replace ) {
    $replace['%description%'] = nl2br( $user->description );
    return $replace;
    }
    add_filter( 'pab_replace_values', 'db_filter_values' );

    Hope that helps,

    Daniel

  3. burkartstudios
    Member
    Posted 3 years ago #

    Where the heck were you before I did a million Google searches and spent 3 hours trying to learn enough PHP to accomplish what I did! =o)

    So this may be a silly question: How do I implement this change?

  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 3 years ago #

    Copy and paste into your theme's functions.php file and you should be set!

  5. burkartstudios
    Member
    Posted 3 years ago #

    You rock!

    So this is where I've used your code if you'd like to see:

    fantastichorror.net/e-zine/

    Still playing with it trying to iron out all the bugs.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic