Support » Fixing WordPress » How to move comments link next to 'by author'?

  • ResolvedModerator t-p

    (@t-p)


    Please someone guide me to move comments link next to ‘by author’.
    For example:
    Posted on April 22, 2010 by admin | Leave a comment

    I am using Twenty Ten theme.

    thanks

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator t-p

    (@t-p)

    can anybody guide please?
    i tried searching this forum, but no luck.

    Thanks.

    t-p,

    Try taking this:

    <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>

    and adding next to:

    <?php twentyten_posted_on(); ?>

    Like this:

    <?php twentyten_posted_on(); ?> | <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>

    This code is located on loop.php.

    Moderator t-p

    (@t-p)

    thanks doc4, your help is greatly appreciated.

    I modified the loop.php as you instructed, but nothing.
    here is where I added the code in loop.php:

    <div class="entry-utility">
    				<a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
    				<span class="meta-sep">|</span>
    				<?php twentyten_posted_on(); ?> | <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    				<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
    			</div><!-- .entry-utility -->
    		</div><!-- #post-## -->

    pleaseguide. thanks.

    Moderator t-p

    (@t-p)

    Hi doc4,

    another place in loop.php I tried placing the code is this:

    <div class="entry-meta">
    				<?php twentyten_posted_on(); ?> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    			</div><!-- .entry-meta -->

    But it nothing again.

    function twentyten_posted_on() {
    	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s | %4$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()
    		),
    comments_popup_link('Leave a comment', '1 Comment', '% Comments', 'comments-link' )
    	);
    }

    Modify this function twentyten_posted_on() in functions.php file with my above code. First take backup of functions.php file

    Moderator t-p

    (@t-p)

    Thanks chinmoy for your response.

    (1). The result is like this:

    Leave a commentPosted on April 22, 2010 by admin |

    (2). Leave a comment link also shows up on the comment page as well. It should show up ONLY on the index page.

    Any other suggestions?

    ok. remove my given function from functions.php file. upload the backup functions.php file.

    Now edit the loop.php file at line 128.Append below code after this code <?php twentyten_posted_on();?>

    <?php if(is_home()):?>
    | <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    <?php endif; ?>

    Whole line should be

    <?php twentyten_posted_on();?> <?php if(is_home()):?>
    | <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    <?php endif; ?>

    Moderator t-p

    (@t-p)

    Thanks chinmoy29.
    Dhanniyavaad ji.

    (1) On Index page it looks like:

    Leave a commentPosted on April 22, 2010 by admin | | Leave a comment

    (2). On comment page it looks like:

    Leave a commentPosted on April 22, 2010 by admin |

    Leave a commentPosted on April 22, 2010 by admin | | Leave a comment. Bold part is coming for updating the twentyten_posted_on() in functions.php file. Now modify the function in functions.php file with the below code(line no 499). One more thing that you’re indian? how to know this language?(Dhanniyavaad ji.):):)

    function twentyten_posted_on() {
    	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$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()
    		)
    	);
    }

    Thx
    C

    Moderator t-p

    (@t-p)

    Got it!

    Dhanniyavaad chinmoy ji.

    you’re welcome.:)

    Plz mark it as resolved.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to move comments link next to 'by author'?’ is closed to new replies.