• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Load author info after header

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Load author info after header

This topic is: resolved

Tagged: author box, child theme, hooks

  • This topic has 5 replies, 2 voices, and was last updated 11 years, 1 month ago by upthink.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • April 17, 2015 at 12:19 pm #148265
    readytoblogdesigns
    Member

    Hi! I'm having a problem that might be incredibly easy to solve but I'm just not seeing it. I'm using the following code to output an author box on posts in a certain category:

    /** Display author box on single posts */
    add_filter( 'get_the_author_genesis_author_box_single', '__return_true' );

    //* Remove the author box on single posts XHTML Themes
    remove_action( 'genesis_after_post', 'genesis_do_author_box_single' );

    //* Remove the author box on single posts HTML5 Themes
    remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );

    add_action('genesis_before_entry', 'vt_author_box', 5);

    function vt_author_box() {
    $output = '';

    if( get_the_author_meta('genesis_author_box_single') == 1 ) :
    $output .= '<div class="author-box">';
    $output .= '<h3 class="author-title">Staff Blog</h3>';
    $output .= get_avatar(get_the_author_meta('user_email'), 75);
    $output .= get_the_author();
    $output .= '<div class="author-inner">';
    $output .= '<div class="inner-left">';

    $output .= '</div>';
    $output .= '<div class="inner-right">';

    $output .= wpautop(get_the_author_meta('description'));

    $output .= '</div>';
    $output .= '<div class="clear"></div>';
    $output .= '</div>';
    $output .= '</div>';
    endif;

    if ( is_single() && in_category( '49' ) ) {
    echo $output;
    }
    }

    The problem for me lies here: add_action('genesis_before_entry', 'vt_author_box', 5);

    I actually need this to show after the header (full width, outside the wrap), but when I hook it in any higher than before entry, the data gets stripped out of the author box. Ideally, I'd like to use: add_action('genesis_after_header', 'vt_author_box', 5);

    Am I being dumb? Is there a way to call the author name/description right after the header on a post page?

    http://67.20.119.100/the-truth-about-poverty-6/
    April 18, 2015 at 8:39 am #148349
    upthink
    Participant

    Why not do something like this:

    add_action( 'genesis_header', 'vt_author_box', 99 );

    April 18, 2015 at 8:53 am #148350
    readytoblogdesigns
    Member

    Hmmm, tried that and it just puts it above the header with the data still stripped out. I'll move it to where I actually want it, the box itself is fine, it's just that the actual author name and description won't get pulled through if I hook it in anywhere above genesis_before_entry...Thanks for having a look, I really appreciate it! Not sure if it's possible to do what I'm trying to do, but I don't really see why not...

    April 18, 2015 at 8:59 pm #148391
    upthink
    Participant

    Ok I see what you mean. basically the function get_the_author() will only work in the WP loop. So whenever you go outside the loop it becomes unavailable. I guess something like this can work:

    
    function vt_author_box() {
    global $post;
    $author_id=$post->post_author;
    
    $output = ”;
    
    if( get_the_author_meta(‘genesis_author_box_single’,  $author_id) == 1 ) :
    $output .= ‘<div class=”author-box”>';
    $output .= ‘<h3 class=”author-title”>Staff Blog</h3>';
    $output .= get_avatar(get_the_author_meta(‘user_email’, $author_id), 75);
    $output .= get_the_author_meta(‘display_name’, $author_id);
    $output .= ‘<div class=”author-inner”>';
    $output .= ‘<div class=”inner-left”>';
    
    $output .= ‘</div>';
    $output .= ‘<div class=”inner-right”>';
    
    $output .= wpautop(get_the_author_meta(‘description’, $author_id));
    
    $output .= ‘</div>';
    $output .= ‘<div class=”clear”></div>';
    $output .= ‘</div>';
    $output .= ‘</div>';
    endif;
    
    if ( is_single() && in_category( ’49’ ) ) {
    echo $output;
    }
    }
    

    Not tested - you may need to tweak it or it may give an error

    April 19, 2015 at 6:45 am #148410
    readytoblogdesigns
    Member

    I did just a bit of tweaking and this did the trick! If anyone is after something similar, here's what gave me the result I was after!

    function vt_author_box() {
    global $post;
    $author_id=$post->post_author;
    $output = '';

    if( get_the_author_meta('genesis_author_box_single', $author_id) == 1 ) :
    $output .= '<div class="author-box">';
    $output .= '<h3 class="author-title">Staff Blog</h3>';
    $output .= get_avatar(get_the_author_meta('user_email'), 75);
    $output .= get_the_author();
    $output .= '<div class="author-inner">';
    $output .= '<div class="inner-left">';

    $output .= '</div>';
    $output .= '<div class="inner-right">';
    $output .= wpautop(get_the_author_meta('display_name', $author_id));
    $output .= wpautop(get_the_author_meta('description', $author_id));

    $output .= '</div>';
    $output .= '<div class="clear"></div>';
    $output .= '</div>';
    $output .= '</div>';
    endif;

    if ( is_single() && in_category( '49' ) ) {
    echo $output;
    }
    }

    Thanks a million, upthink! Let me know where I can send your virtual gift basket! 🙂

    April 19, 2015 at 11:34 pm #148491
    upthink
    Participant

    Glad to help 🙂

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble