• Resolved Andrew

    (@cipes)


    Hi Folks,
    I’m running a basic child theme of Twenty Twelve that allows me to use post excerpts on the homepage as well as customized featured images and a ‘continue reading’ link. It was all followed step by step from the tutorial available here.

    Everything seems to ‘look’ fine, but when I actually navigate to the posts, either through the admin, or through the front side links, there is no content displayed, just the post title and comments. See this screen capture.

    The site is a protected server so I can’t share a link right now. But I’m going to post all the markup and my content.php to see if folks might be able to point me in the right direction. I’m totally stumped as to why it would do this. It seems like the entry-content div is being skipped completely.

    I’ve disabled all plugins in order to test this. Brand new install with new themes and defaults all around. Any help or guidance would be great.

    Here’s the markup for the above screenshot..

    And here is a copy of my content.php

    <?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 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>
    		</header><!-- .entry-header -->
    
    		<?php if ( is_search() || is_home()) : // Only display Excerpts for Search & Home ?>
    		<div class="entry-summary">
    			 <!-- Adds the 140x140 thumbnail/featured image -->
    	        <div class="excerpt-thumb">
    	            <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
    	            <?php the_post_thumbnail('excerpt-thumbnail', 'class=alignleft'); ?>
    	            </a>
    	        </div>
    			<?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; ?>
    
    		<footer class="entry-meta">
    			<?php endif; // is_single() ?>
    			<?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() ?>
    			<?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 -->

    and here’s my functions.php

    <?php
    
    // Add 140x140 image size
    add_image_size('excerpt-thumbnail', 300, 240, true);
    
    // Remove the ... from excerpt and change the text
    function change_excerpt_more()
    {
      function new_excerpt_more($more)
        {
        // Use .read-more to style the link
          return '<span class="continue-reading"> <a href="' . get_permalink() . '">Continue Reading &raquo;</a></span>';
        }
      add_filter('excerpt_more', 'new_excerpt_more');
    }
    add_action('after_setup_theme', 'change_excerpt_more');

    Thanks a bunch for your time!

Viewing 2 replies - 1 through 2 (of 2 total)
  • This was misplaced.

    <?php endif; // is_single() ?>

    I see you want to move comment edit to footer but that one shouldn’t get moved too, it was part of the check for entry-title.

    Maybe there’s something else too, or maybe not, but at least this is what I noticed.

    Thread Starter Andrew

    (@cipes)

    Thanks Paul! You nailed it. I must have copy pasted a bit too much code (including the misplaced line) while I was working with the is_single() adjustments from the tut.

    1000 Thank yous!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post Content Not Displaying’ is closed to new replies.