Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author David Vongries

    (@davidvongries)

    Hi @ricardocnn,

    Page Builder Framework does not currently have a author box built-in.

    You can add the code below to your child-theme’s functions.php as a starting point. That’s actually the one I’m using on the Page Builder Framework website at the bottom – https://wp-pagebuilderframework.com/advanced-blog-layouts/

    // Author Box
    function mysite_author_bio_bottom() {
    
    	// Stop here if we're not on a post.
    	if ( ! is_singular( 'post' ) ) return;
    
    	$display_name     = get_the_author_meta( 'display_name' );
    	if ( empty( $display_name ) ) {
    		$display_name = get_the_author_meta( 'nickname' );
    	}
    	$user_description = get_the_author_meta( 'user_description' );
    	$author_website   = get_the_author_meta('url');
    	$twitter          = get_the_author_meta('twitter' );
    	$facebook         = get_the_author_meta('facebook');
    	$avatar           = get_avatar( get_the_author_meta('user_email') , 180 );
    	$social           = "";
    
    	if ( !empty( $twitter ) ) {
    		$social      .= '<a target="_blank" href="https://twitter.com/'. $twitter .'"><i class="fab fa-twitter" aria-hidden="true"></i></i></a>';
    	}
    
    	if ( !empty( $facebook ) ) {
    		$social      .= '<a target="_blank" href=" '. $facebook .'"><i class="fab fa-facebook" aria-hidden="true"></i></a>';
    	}
    
    	$author_social    = '<p class="author-social">'. $social .'</p>';
    
    	$author_details  .= '<p class="author-name"><a href="'. $author_website .'"> ' . $display_name . '</a></p>';
    	$author_details  .= '<p>' .nl2br( $user_description ) .'</p>';
    	$author_details  .= $author_social;
    
    	$author_box       = '<div class="author-box-divider"></div>';
    	$author_box      .= '<h3 class="wpbf-margin-medium-top wpbf-hidden-small">About the Author</h3>';
    	$author_box      .= '<div class="author-box-footer wpbf-margin wpbf-hidden-small">';
    	$author_box      .= '<div class="wpbf-grid">';
    	$author_box      .= '<div class="wpbf-1-4">';
    	$author_box      .= $avatar;
    	$author_box      .= '</div>';
    	$author_box      .= '<div class="wpbf-3-4">';
    	$author_box      .= $author_details;
    	$author_box      .= '</div>';
    	$author_box      .= '</div>';
    	$author_box      .= '</div>';
    
    	echo $author_box;
    
    }
    add_action( 'wpbf_before_comment_form', 'mysite_author_bio_bottom', 15 );
    Thread Starter ricardocnn

    (@ricardocnn)

    Thank you David!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘author box in posts’ is closed to new replies.