• Resolved SkyWayne

    (@skywayne)


    I apologize, because I know this question has been asked a lot . . . I promise that I have reviewed every post in the “remove author” forum and have not been able to figure it out.

    The question is fairly straightforward: How do I remove the author tag on each post but leave the date intact? I was successfully able to remove both by adding “//” to the posted_on code in loop, but I would like to maintain the date.

    I also tried editing out this code from functions.php:

    ,
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    			get_author_posts_url( get_the_author_meta( 'ID' ) ),
    			sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
    			get_the_author()
    		)

    . . . but the result was a syntax error. If that didn’t frustrate me enough, when I tried other tidbits, I was given a “printf()[function.print]: Too few arguments . . . .” error message. I am not a coder, so any SPECIFIC help you can offer (i.e. telling what code to replace, remove, etc. and its location) would be very greatly appreciated.

    Have a great day!

Viewing 7 replies - 1 through 7 (of 7 total)
  • first up, editing twentyten is a no-no, child theme is the way to go

    https://go.rvoodoo.com/WPchild

    You are in the right place…. you would copy that function to your child theme’s functions.php, and then edit it

    function twentyten_posted_on() {
    	printf( __( '<span class="%1$s">Posted on</span> %2$s' , 'twentyten' ),
    		'meta-prep meta-prep-author',
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
    			get_permalink(),
    			esc_attr( get_the_time() ),
    			get_the_date()
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    			get_author_posts_url( get_the_author_meta( 'ID' ) ),
    			sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
    			get_the_author()
    		)
    	);
    }

    should do it really… just removing

    <span class="meta-sep">by</span> %3$s',

    from the output

    twenty ten author removed from ‘posted on’

    here is that function twentyten_posted_on() edited:

    https://pastebin.com/M8rT60rV

    thanks @alchymyth…. probably good to remove the unneeded stuff besides just pulling out the placeholder

    Thread Starter SkyWayne

    (@skywayne)

    Just copied and pasted the code from your link above in child theme functions.php (between the last “}” and the “endif.” Worked beautifully! Thank you so much!

    This is by far the best thread I’ve found on this subject. It just occurred to me however, that I might just edit out the “meta-sep” and “author vcard” spans in my CSS using “display: none” and that worked. Is this an acceptable alternative to editing the code in functions.php, or would you guys recommend against it?

    I might just edit out the “meta-sep” and “author vcard” spans in my CSS using “display: none” and that worked.

    this often works; however, if you would just want to take the ‘on’ part of the ‘posted on’ out, this would not work with css.

    general, there are pros and cons for the css method:

    pro:
    easy to return to the previous state;
    little programming knowledge needed;
    easy to apply to a child theme;
    in certain situations, it might be a pro that the output is still visible in the html code in the browser.

    cons:
    higher load on the server (the php needs to be parsed, and the code generated);
    extra bandwidth (the generated html code needs to be downloaded to the server);
    visibility (the code is still visible in the browser);
    extra work for the browser to hide the content;
    unless you have a backup, going back to the previous state is difficult;

    there is probably more, and what you do at the end, depends on the individual circumstances.

    Thank you for the detailed response, alchmyth it certainly offers some considerations I hadn’t taken into account, particularly on the “cons” side of the ledger. I’ll definitely take this into account as I proceed. ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove Author (But Leave Date) on TwentyTen Theme’ is closed to new replies.