• 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 change post info author links to my Gplus with vcard?

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 change post info author links to my Gplus with vcard?

This topic is: not resolved

Tagged: .post-info, Author, author link

  • This topic has 1 reply, 2 voices, and was last updated 5 years, 8 months ago by Brad Dalton.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 21, 2017 at 7:17 am #206784
    ictiempo
    Member

    Hi,

    I just change my theme to Genesis but I found it hard to change the author links to my google plus with vcard. Any help will be appreciated.

    https://www.techchore.com/
    May 22, 2017 at 5:25 am #206796
    Brad Dalton
    Participant

    Hi

    Generally, the author link goes to a page with posts from the author, not an external link however it can be done.

    If you're up for coding, you can copy one of the functions from Genesis and modify or filter it.

    Note : Happy to point you in the right direction however this code modification and testing would take some time and is not covered here today.

    add_shortcode( 'post_author_link', 'genesis_post_author_link_shortcode' );
    /**
     * Produces the author of the post (link to author URL).
     *
     * Supported shortcode attributes are:
     *   after (output after link, default is empty string),
     *   before (output before link, default is empty string).
     *
     * Output passes through genesis_post_author_link_shortcode filter before returning.
     *
     * @since 1.1.0
     *
     * @param array|string $atts Shortcode attributes. Empty string if no attributes.
     * @return string Return empty string if post type does not support author or post has no author assigned.
     *                Return genesis_post_author_shortcode() if author has no URL.
     *                Otherwise, output for post_author_link shortcode.
     */
    function genesis_post_author_link_shortcode( $atts ) {
    
    	if ( ! post_type_supports( get_post_type(), 'author' ) ) {
    		return '';
    	}
    
    	$url = get_the_author_meta( 'url' );
    
    	// If no URL, use post author shortcode function.
    	if ( ! $url ) {
    		return genesis_post_author_shortcode( $atts );
    	}
    
    	$author = get_the_author();
    
    	if ( ! $author ) {
    		return '';
    	}
    
    	$defaults = array(
    		'after'    => '',
    		'before'   => '',
    	);
    
    	$atts = shortcode_atts( $defaults, $atts, 'post_author_link' );
    
    	if ( genesis_html5() ) {
    		$output  = sprintf( '<span %s>', genesis_attr( 'entry-author' ) );
    		$output .= $atts['before'];
    		$output .= sprintf( '', $url, genesis_attr( 'entry-author-link' ) );
    		$output .= sprintf( '<span %s>', genesis_attr( 'entry-author-name' ) );
    		$output .= esc_html( $author );
    		$output .= '</span>' . $atts['after'] . '</span>';
    	} else {
    		$link = '' . esc_html( $author ) . '';
    		$output = sprintf( '<span class="author vcard">%2$s<span class="fn">%1$s</span>%3$s</span>', $link, $atts['before'], $atts['after'] );
    	}
    
    	return apply_filters( 'genesis_post_author_link_shortcode', $output, $atts );
    
    }
    
    add_shortcode( 'post_author_posts_link', 'genesis_post_author_posts_link_shortcode' );
    /**
     * Produces the author of the post (link to author archive).
     *
     * Supported shortcode attributes are:
     *   after (output after link, default is empty string),
     *   before (output before link, default is empty string).
     *
     * Output passes through genesis_post_author_posts_link_shortcode filter before returning.
     *
     * @since 1.1.0
     *
     * @param array|string $atts Shortcode attributes. Empty string if no attributes.
     * @return string Return empty string if post type does not support author or post has no author assigned.
     *                Otherwise, output for post_author_posts_link shortcode.
     */
    function genesis_post_author_posts_link_shortcode( $atts ) {
    
    	if ( ! post_type_supports( get_post_type(), 'author' ) ) {
    		return '';
    	}
    
    	$author = get_the_author();
    
    	if ( ! $author ) {
    		return '';
    	}
    
    	$defaults = array(
    		'after'  => '',
    		'before' => '',
    	);
    
    	$atts = shortcode_atts( $defaults, $atts, 'post_author_posts_link' );
    
    	$url = get_author_posts_url( get_the_author_meta( 'ID' ) );
    
    	if ( genesis_html5() ) {
    		$output  = sprintf( '<span %s>', genesis_attr( 'entry-author' ) );
    		$output .= $atts['before'];
    		$output .= sprintf( '', $url, genesis_attr( 'entry-author-link' ) );
    		$output .= sprintf( '<span %s>', genesis_attr( 'entry-author-name' ) );
    		$output .= esc_html( $author );
    		$output .= '</span>' . $atts['after'] . '</span>';
    	} else {
    		$link   = sprintf( '%s', esc_url( $url ), esc_html( $author ) );
    		$output = sprintf( '<span class="author vcard">%2$s<span class="fn">%1$s</span>%3$s</span>', $link, $atts['before'], $atts['after'] );
    	}
    
    	return apply_filters( 'genesis_post_author_posts_link_shortcode', $output, $atts );
    
    }
    

    Get Help – Book Consultation.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 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

© 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