Anyone familiar with WP's functions.php?

muscleteen

Power Member
Joined
Oct 28, 2008
Messages
679
Reaction score
1,074
Okay, so I'm using the Twenty Thirteen theme. Under each post title, there is the author name that links to the author page (which links to all the posts of the author). But since the website has only 1 author, the author page is basically a replica of the home page (Yep, duplicate content issues).

I would like to keep the author name there, but remove the link to the author page. I don't know PHP at all, but I'm pretty sure it has to do with the functions.php file, more specifically, this part (the last lines):

Code:
function twentythirteen_entry_meta() {
	if ( is_sticky() && is_home() && ! is_paged() )
		echo '<span class="featured-post">' . __( 'Sticky', 'twentythirteen' ) . '</span>';

	if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )
		twentythirteen_entry_date();

	// Translators: used between list items, there is a space after the comma.
	$categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) );
	if ( $categories_list ) {
		echo '<span class="categories-links">' . $categories_list . '</span>';
	}

	// Translators: used between list items, there is a space after the comma.
	$tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );
	if ( $tag_list ) {
		echo '<span class="tags-links">' . $tag_list . '</span>';
	}

	// Post author
	if ( 'post' == get_post_type() ) {
		printf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
			esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),
			get_the_author()
		);
	}
}

Can anyone help? (And yes, I have already created a child theme)
 
Do you have a link to the website? What I THINK you have done, set as a static page, so it looks like there's two of the same. Would need to see it really, PM if need.
 
Do you have a link to the website? What I THINK you have done, set as a static page, so it looks like there's two of the same. Would need to see it really, PM if need.
What you are looking for can be found in single.php if I'm not wrong. Add me on Skype if you need any help, I am not an expert but I can easily do stuff like this.
Edit: my bad, it should be in functions.php, but not the code you posted here.
 
I am no expert but I would take a guess at removing the href="%1$s". By no expert I do not mean I am clueless.
 
Do you have a link to the website? What I THINK you have done, set as a static page, so it looks like there's two of the same. Would need to see it really, PM if need.

No, it's not set to static. I'm still trying a couple of things, then will PM you if I can't. Thanks!

@mickyfu:
Yes, taking the "href" out does take out the link, but it leaves it with the "View all posts by AUTHOR" upon hovering with the cursor.

Actually, I was able to take the link out, but ideally, I would want no "extra" coding. Just the piece needed to display the author's name.
 
Last edited:
If you do not want the hover text take title="%2$s" out of it. I would guess that is the title to the link.
 
Try to change this:
Code:
printf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',

to this:
Code:
printf( '<span class="author vcard">%3$s</span>',

If you want to also remove View all posts by AUTHOR

then try to replace this:
Code:
esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),

with
Code:
'',
 
Last edited:
Replace the old function with the new one (I would have modified it as a child theme but this works too)
Code:
function twentythirteen_entry_meta() {
    if ( is_sticky() && is_home() && ! is_paged() )
        echo '<span class="featured-post">' . __( 'Sticky', 'twentythirteen' ) . '</span>';

    if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )
        twentythirteen_entry_date();

    // Translators: used between list items, there is a space after the comma.
    $categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) );
    if ( $categories_list ) {
        echo '<span class="categories-links">' . $categories_list . '</span>';
    }

    // Translators: used between list items, there is a space after the comma.
    $tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );
    if ( $tag_list ) {
        echo '<span class="tags-links">' . $tag_list . '</span>';
    }

    // Post author
    if ( 'post' == get_post_type() ) {
    
        printf( '<span class="author vcard">%s</span>',
            
            get_the_author()
        );
    }
}
 
Thanks guys! I used a combination of what you suggested to get an output that I want! Looks good now! :)
 
^ so many replies , people love to help muscleteen.
i thought you will never return to bhw (you were offline since some months)
welcome back.
-=-
 
It may be hard to do that without checking it in real time.

Try removing that part after // Post author.
 
Back
Top