WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to move comments link next to 'by author'? (12 posts)

  1. Tara
    Member
    Posted 3 years ago #

    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

  2. Tara
    Member
    Posted 3 years ago #

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

    Thanks.

  3. doc4
    Member
    Posted 3 years ago #

    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.

  4. Tara
    Member
    Posted 3 years ago #

    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.

  5. Tara
    Member
    Posted 3 years ago #

    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.

  6. chinmoy
    Member
    Posted 3 years ago #

    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

  7. Tara
    Member
    Posted 3 years ago #

    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?

  8. chinmoy
    Member
    Posted 3 years ago #

    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; ?>
  9. Tara
    Member
    Posted 3 years ago #

    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 |

  10. chinmoy
    Member
    Posted 3 years ago #

    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

  11. Tara
    Member
    Posted 3 years ago #

    Got it!

    Dhanniyavaad chinmoy ji.

  12. chinmoy
    Member
    Posted 3 years ago #

    you're welcome.:)

    Plz mark it as resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.