• Hi,

    Does the free version of Astra have a way to add an author box at the end of posts? And if not, what would you suggest to use instead?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can use any Author box plugin. Or do it yourself, for example, like this:
    functions.php:

    // Author Info Box
    function wpb_author_info_box( $content ) {
      
    global $post;
      
    // Detect if it is a single post with a post author
    if ( is_single() && isset( $post->post_author ) ) {
      
    // Get author's display name 
    $display_name = get_the_author_meta( 'display_name', $post->post_author );
      
    // If display name is not available then use nickname as display name
    if ( empty( $display_name ) )
    $display_name = get_the_author_meta( 'nickname', $post->post_author );
      
    // Get author's biographical information or description
    $user_description = get_the_author_meta( 'user_description', $post->post_author );
      
    // Get author's website URL 
    $user_website = get_the_author_meta('url', $post->post_author);
      
    // Get link to the author archive page
    $user_posts = get_author_posts_url( get_the_author_meta( 'ID' , $post->post_author));
       
    if ( ! empty( $display_name ) )
      
    $author_details = '<p class="author_name">About ' . $display_name . '</p>';
      
    if ( ! empty( $user_description ) )
    // Author avatar and bio
      
    $author_details .= '<p class="author_details">' . get_avatar( get_the_author_meta('user_email') , 90 ) . nl2br( $user_description ). '</p>';
      
    $author_details .= '<p class="author_links"><a href="'. $user_posts .'">View all posts by ' . $display_name . '</a>';  
      
    // Check if author has a website in their profile
    if ( ! empty( $user_website ) ) {
      
    // Display author website link
    $author_details .= ' | <a href="' . $user_website .'" target="_blank" rel="nofollow">Website</a></p>';
      
    } else { 
    // if there is no author website then just close the paragraph
    $author_details .= '</p>';
    }
      
    // Pass all this info to post content  
    $content = $content . '<footer class="author_bio_section" >' . $author_details . '</footer>';
    }
    return $content;
    }
      
    // Add our function to the post content filter 
    add_action( 'the_content', 'wpb_author_info_box' );
      
    // Allow HTML in author bio section 
    remove_filter('pre_user_description', 'wp_filter_kses');

    CSS:

    .author_bio_section{
    background-color: #F5F5F5;
    padding: 15px;
    border: 1px solid #ccc;
    }
    .author_bio_section:after{
    content: "";
    clear: both;
    display: block;
    }
    
    .author_name{
    font-size:16px;
    font-weight: bold;
    }
      
    .author_details img {
    border: 1px solid #D8D8D8;
    border-radius: 50%;
    float: left;
    margin: 0 10px 10px 0;
    }

    For mobile, you can change the CSS so that the avatar image does not have a float. To do this, use media queries.

    • This reply was modified 4 years, 2 months ago by zabavljaev.

    This code is not a good option, since all the headers in it will be in the language in which you write them directly in the code. Some plugins also do not have localization. In addition, the choice of the plugin depends on what you need to display in the Author box.
    Just enter “Author box” in the search for plugins and install the one that suits you the most.
    Or you will have to write a plugin yourself, which is not always rational, since there are many good plugins.
    Try this plugin:
    https://wordpress.org/plugins/starbox/
    Languages into which it is translated: English (US), Russian, Slovak and Spanish (Mexico). You can add your language here https://translate.wordpress.org/projects/wp-plugins/starbox/ Or use the Poedit program

    Hello @lauratraveler

    No, the free version of the Astra theme does not have the feature to display Author info below the posts. You will need the Astra Pro version for the same.

    While you can use plugin mentioned in this article to help you achieve this requirement or you can update to the Astra Pro version.

    Regards,
    Suman

    I did not know the Astra Pro theme has such an opportunity.

    Hello @zabavljaev

    If you have the Astra Pro version dive in now and let us know if you have any further queries.

    Regards,
    Suman

    Many thanks! I use the free version of the theme. Firstly, buying an Astra PRO theme is expensive (for me), and secondly, I like to do it myself.

    You’re most welcome, @zabavljaev!

    Do let us know if there is anything else we can help you with.

    Regards,
    Suman

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Author box’ is closed to new replies.