• 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

How do I link author name to author archive?

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 › StudioPress Themes › Genesis Sample › How do I link author name to author archive?

This topic is: not resolved

Tagged: author box title, author name, author url

  • This topic has 1 reply, 2 voices, and was last updated 1 year, 11 months ago by Brad Dalton.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • September 23, 2021 at 10:10 am #504477
    Anonymous
    Inactive

    I'm using the latest version of Genesis Sample (3.4.1).

    First thing first, my author box code in the functions.php file isn't original anymore, I changed it to this:

    //* Modify the author box
    add_filter( 'genesis_author_box', 'sk_author_box' );
    function sk_author_box() {
    
    	// Author's Gravatar image
    	$gravatar_size = apply_filters( 'genesis_author_box_gravatar_size', 70, $context );
    	$gravatar      = get_avatar( get_the_author_meta( 'email' ), $gravatar_size );
    
    	// Author's name
    	$name = get_the_author();
    	$title = get_the_author_meta( 'title' );
    	if( !empty( $title ) )
    		$name .= ', ' . $title;
    
    	// Author's Biographical info
    	$description   = wpautop( get_the_author_meta( 'description' ) );
    
    	// Build Author box output
    	$output = '';
    	$output .= '<section class="author-box" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">';
    	$output .= $gravatar;
    	$output .= '<h3 class="author-box-title"><span itemprop="name">' . $name .'</span></h3>';
    	$output .= '<div itemprop="description" class="author-box-content">' . $description . '</div>';
    	$output .= '</section>';
    	return $output;
    
    }

    It's great, it gets me the author-box-title to be presented in H3 (Genesis default is H4).

    But the problem is, it's not linking to its archive page (example.com/author/johnsmith).

    I want the author name to be clickable and linking to its author archive page.

    What code should be added/removed/changed to achieve that?

    Thanks

    https://ungraduate.com/social-media-minimalism/
    October 27, 2021 at 3:06 am #504548
    Brad Dalton
    Participant

    Have a look at the function in Genesis for the author shortcode which will include a function for the author archive. You can then use that in your author box code.


    Tutorials for StudioPress Themes & WooCommerce.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 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