1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Anyone familiar with WP's functions.php?

Discussion in 'Web Design' started by muscleteen, Feb 14, 2014.

  1. muscleteen

    muscleteen Regular Member

    Joined:
    Oct 28, 2008
    Messages:
    397
    Likes Received:
    861
    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)
     
  2. Apricot

    Apricot Administrator Staff Member Moderator

    Joined:
    Mar 26, 2013
    Messages:
    11,962
    Likes Received:
    6,444
    Gender:
    Female
    Occupation:
    BHW Moderator
    Location:
    London
    Home Page:
    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.
     
    • Thanks Thanks x 1
  3. lord1027

    lord1027 Elite Member

    Joined:
    Sep 20, 2013
    Messages:
    3,174
    Likes Received:
    2,222
    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.
     
  4. mickyfu

    mickyfu Jr. VIP Jr. VIP Premium Member

    Joined:
    Dec 14, 2011
    Messages:
    5,259
    Likes Received:
    15,409
    Location:
    Jennifers Office.
    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.
     
    • Thanks Thanks x 2
  5. muscleteen

    muscleteen Regular Member

    Joined:
    Oct 28, 2008
    Messages:
    397
    Likes Received:
    861
    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: Feb 14, 2014
  6. mickyfu

    mickyfu Jr. VIP Jr. VIP Premium Member

    Joined:
    Dec 14, 2011
    Messages:
    5,259
    Likes Received:
    15,409
    Location:
    Jennifers Office.
    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.
     
    • Thanks Thanks x 2
  7. laowai

    laowai Power Member

    Joined:
    Feb 27, 2011
    Messages:
    522
    Likes Received:
    184
    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:
    '',
     
    • Thanks Thanks x 2
    Last edited: Feb 14, 2014
  8. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,062
    Likes Received:
    2,872
    Gender:
    Male
    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 Thanks x 2
  9. muscleteen

    muscleteen Regular Member

    Joined:
    Oct 28, 2008
    Messages:
    397
    Likes Received:
    861
    Thanks guys! I used a combination of what you suggested to get an output that I want! Looks good now! :)
     
  10. prab1996

    prab1996 Elite Member

    Joined:
    Jan 8, 2013
    Messages:
    3,496
    Likes Received:
    2,027
    Occupation:
    your gf's <3 ♥♥♥♥
    Location:
    Prab1996.com
    Home Page:
    ^ so many replies , people love to help muscleteen.
    i thought you will never return to bhw (you were offline since some months)
    welcome back.
    -=-
     
    • Thanks Thanks x 1
  11. muscleteen

    muscleteen Regular Member

    Joined:
    Oct 28, 2008
    Messages:
    397
    Likes Received:
    861
    Naaahh. People on here generally like to help (everyone).

    Oh you noticed! Yeah, I was very busy with Uni. Med school is getting tougher every year :-(

    Thank you man :) I appreciate it.
     
  12. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    Moved from the Lounge.
     
    • Thanks Thanks x 1
  13. umerjutt00

    umerjutt00 Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 28, 2011
    Messages:
    3,644
    Likes Received:
    1,904
    Occupation:
    Ninja