WordPress.org

Ready to get started?Download WordPress

Forums

Filter Author Box Description (1 post)

  1. devoninternational
    Member
    Posted 1 year ago #

    I am wondering how I would alter the $description variable by using a filter or some other efficient way. Thanks.

    function author_box( $context = '' ) {
    
    	global $authordata;
    	$authordata = is_object( $authordata ) ? $authordata : get_userdata( get_query_var('author') );
    
    	$gravatar_size = apply_filters('author_box_gravatar_size', '70', $context);
    	$gravatar = get_avatar( get_the_author_meta('email'), $gravatar_size );
    	$title = apply_filters( 'author_box_title', sprintf( '<strong>%s %s</strong>', __('About', 'parent'), get_the_author() ), $context );
    	$description = wpautop( get_the_author_meta('description') );
    
    	// The author box markup, contextual.
    	$pattern = $context == 'single' ? '<div class="author-box"><div>%s %s<br />%s</div></div><!-- end .authorbox-->' : '<div class="author-box">%s<h1>%s</h1><div>%s</div></div><!-- end .authorbox-->';
    
    	echo apply_filters( 'author_box', sprintf( $pattern, $gravatar, $title, $description ), $context, $pattern, $gravatar, $title, $description );
    
    }

Topic Closed

This topic has been closed to new replies.

About this Topic