WordPress.org

Forums

Twenty Fourteen
[resolved] href for byline (4 posts)

  1. jbearsavo
    Member
    Posted 1 year ago #

    Okay. I love Twenty Fourteen. I created a child theme and started using it on my blog, which is single author.

    So, the byline doesn't display on the homepage, archives, search, etc., but it does display on single posts...

    I want to change the href on the byline to point to my About page rather than an author archive. Thing is, I can't find in the theme where the byline is.

    Which file? Which template? Please tell me how to find it.

    Thanks

  2. Hi there, I looked at the source code and then used a multi-file search to discover that the author byline is coming from the twentyfourteen_posted_on() function in inc/template-tags.php.

    You can try overriding this function by redeclaring it in your child theme.

    To do that, place it in a blank file called functions.php in your child theme folder:

    <?php
    if ( ! function_exists( 'twentyfourteen_posted_on' ) ) :
    /**
     * Print HTML with meta information for the current post-date/time and author.
     *
     * @since Twenty Fourteen 1.0
     *
     * @return void
     */
    function twentyfourteen_posted_on() {
    	if ( is_sticky() && is_home() && ! is_paged() ) {
    		echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>';
    	}
    
    	// Set up and print post meta information.
    	printf( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="http://mysite.com/about/" rel="author">%5$s</a></span></span>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    		get_the_author()
    	);
    
    	echo '';
    }
    endif;
    ?>

    Be sure to change this placeholder URL to your real about page URL: http://mysite.com/about/

  3. jbearsavo
    Member
    Posted 1 year ago #

    Kathryn,

    That did the trick. Thanks a bunch.

  4. My pleasure. :-)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags