• Resolved sbbn

    (@sbbn)


    I’d like to move the “Leave a Reply” link from the top of my post to the bottom. I’ve seen some posts about it but none of them provide exactly what I’m looking for. The code in content.php that I think I need to change is here:

    <?php if ( comments_open() ) : ?>
    				<div class="comments-link">
    					<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
    				</div><!-- .comments-link -->
    			<?php endif; // comments_open() ?>

    I have a child theme already and would just put a new content.php in there with the changes, but I can’t figure out what specifically I should change.

    URL: shebloggedbynight.com

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • It looks like the first step would be to save this as a content.php in your child theme:

    <?php
    /**
     * The default template for displaying content. Used for both single and index/archive/search.
     *
     * @package WordPress
     * @subpackage Twenty_Twelve
     * @since Twenty Twelve 1.0
     */
    ?>
    
    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
    		<div class="featured-post">
    			<?php _e( 'Featured post', 'twentytwelve' ); ?>
    		</div>
    		<?php endif; ?>
    		<header class="entry-header">
    			<?php the_post_thumbnail(); ?>
    			<?php if ( is_single() ) : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    			<?php else : ?>
    			<h1 class="entry-title">
    				<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
    			</h1>
    			<?php endif; // is_single() ?>
    		</header><!-- .entry-header -->
    
    		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    		<?php else : ?>
    		<div class="entry-content">
    			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    		<?php endif; ?>
    
    		<?php if ( comments_open() ) : ?>
    				<div class="comments-link">
    					<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
    				</div><!-- .comments-link -->
    			<?php endif; // comments_open() ?>
    
    		<footer class="entry-meta">
    			<?php twentytwelve_entry_meta(); ?>
    			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
    			<?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
    				<div class="author-info">
    					<div class="author-avatar">
    						<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>
    					</div><!-- .author-avatar -->
    					<div class="author-description">
    						<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
    						<p><?php the_author_meta( 'description' ); ?></p>
    						<div class="author-link">
    							<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
    								<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentytwelve' ), get_the_author() ); ?>
    							</a>
    						</div><!-- .author-link	-->
    					</div><!-- .author-description -->
    				</div><!-- .author-info -->
    			<?php endif; ?>
    		</footer><!-- .entry-meta -->
    	</article><!-- #post -->

    It moves the comment div below the content and above the meta. You’d then need to test it and see if any CSS changes are necessary.

    Thread Starter sbbn

    (@sbbn)

    Terrific, that worked – thanks! I also tested by replying to a post, and it works fine.

    What do you mean about CSS changes? I’m not sure what to look for.

    If you’re happy with how it looks, you don’t have to worry about any CSS changes. What I meant was that I didn’t test it so I didn’t know if moving the code block might have put something else out of whack in terms of appearance (just cosmetic stuff, nothing functional) that would require some CSS tweaks to fix.

    Thread Starter sbbn

    (@sbbn)

    Ah, got it. Thanks for the code, it worked great!

    Genius!

    Caroline@tasteloveandnourish

    (@carolinetasteloveandnourish)

    This was soooo helpful! Thanks so much!

    Logging in here just to say thank you linux4me2!

    Hey linux4me2, soooo helpful! Thanks so much!

    Just what I was looking for – thanks!

    Still new to knowing just how everything works but I am just wondering about this on the content.php example above:

    * @since Twenty Twelve 1.0

    Does this mean if/when Twenty Twelve has a newer version the content.php in the child folder I created will no longer apply?

    linux4me2 thank you thank you thank you
    I had been struggling for hours with this.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘TwentyTwelve moving "Leave a Reply" to bottom of post’ is closed to new replies.