• 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 to add an image link to a specific authors posts?

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 › How to add an image link to a specific authors posts?

This topic is: resolved

Tagged: Author, post_author

  • This topic has 2 replies, 2 voices, and was last updated 7 years, 11 months ago by lwharris.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 16, 2015 at 11:58 am #148145
    lwharris
    Participant

    I am using Genesis Sample theme.

    I want to have an author of the week & include their website logo on all of their posts. I've created the widget below, but it doesn't display the author's logo. I can get the logo to display on everyone's posts, or on no one's posts, but not just on Sam Smith's posts.

    This is my code attempt:

    //My attempt at inserting a widget at the end of a post_info    
    	//if the author is Sam Smith
    //* Register a widget area called 'author-logo'
    genesis_register_sidebar( array(
    	'id'            => 'author-logo',
    	'name'          => __( 'Author Logo Widget', 'sample' ),
    	'description'   => __( 'Author-of-the-Month logo.', 'sample' ),
    ) );
    
    if ( 'post_author' == 'Sam Smith) {
    add_action( 'genesis_entry_footer', 'add_author_logo' );
    	function add_author_logo() {	
    		genesis_widget_area( 'author-logo', array(
    			'before' => '<div class="author-logo widget-area">',
    			'after' => '</div>',
    		) );
    	}
    }

    What am I doing wrong above & is there a better way?

    April 16, 2015 at 12:29 pm #148147
    Brad Dalton
    Participant

    Add the conditional tag after the function and populate the widget with the Genesis Users profile widget.

    I doubt this will work:

    if ( 'post_author' == 'Sam Smith) {
    

    You'll need to find the conditional for authors


    Tutorials for StudioPress Themes.

    April 16, 2015 at 1:57 pm #148156
    lwharris
    Participant

    Thanks for pointing me in the right direction. Here is the code that worked.

    //Inserting author logo widget at the end of a post_info 
    	//if the author is Sam Smith
    //* Register a widget area called 'author-logo'
    genesis_register_sidebar( array(
    	'id'            => 'author-logo',
    	'name'          => __( 'Author Logo Widget', 'sample' ),
    	'description'   => __( 'Author-of-the-Month logo.', 'sample' ),
    ) );
    
    add_action( 'genesis_entry_footer', 'add_author_logo' );
    	function add_author_logo() {
    		$author = get_the_author(); 	
    		if ( $author == 'Sam Smith') {     
    		genesis_widget_area( 'author-logo', array(
    			'before' => '<div class="author-logo widget-area">',
    			'after' => '</div>',
    		) );
    	}
    }

    🙂

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘How to add an image link to a specific authors posts?’ is closed to new replies.

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