• Hi,

    I am having issues with the_content() and the_excerpt() and I hope someone may have a solution.

    the_content() is not displaying any content when using single.php. I’ve tried all the usual trouble-shooting stuff (disabled plugins etc) to no avail. The post is displayed when switching to twentytwelve however replacing the code in my single.php with the code from the 2012 one does not fix the issue.

    <div id="leftcol" class="span8">
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <article class="post">
              <div class="post_content">
                   <figure><?php if ( has_post_thumbnail() ) {the_post_thumbnail();} ?></figure>
                   <?php the_content(); ?>
              </div>
        </article>
        <ul class="pager">
            <li class="previous disabled"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></li>
            <li class="next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></li>
        </ul>
    
        <?php endwhile; // end of the loop. ?>
        <?php endif; ?>
    </div>

    Using echo $post->post_content; does work but also causes issues with image captions displaying the html.

    My issue with the_excerpt() is in the index.php though I suspect that these 2 issues are related.

    Cheers,
    Dan

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    What theme are you using?

    Thread Starter Punk Daddy

    (@punk-daddy)

    It is a custom built theme created to match my client’s existing site.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    What is the full code for the single.php file?

    Thread Starter Punk Daddy

    (@punk-daddy)

    <?php get_header(); ?>
    <!-- SPECIFIC PAGE CONTENT BEGINS HERE -->
    
         <div class="container">
              <section id="blog">
                   <div class="hgroup">
                        <h1><?php the_title(); ?></h1>
                        <h2><i class="icon-time"></i><?php the_time('F jS, Y') ?></h2>
                        <ul class="breadcrumb pull-right">
                             <li><a href="/blog">back to blog home</a></li>
                        </ul>
                   </div>
                   <div class="row">
                        <div id="leftcol" class="span8">
                   			<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                            <article class="post">
                                  <div class="post_content">
                                       <figure><?php if ( has_post_thumbnail() ) {the_post_thumbnail();} ?></figure>
                                       <?php the_content(); ?>
                                  </div>
                            </article>
    			            <ul class="pager">
                  				<li class="previous disabled"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></li>
                   				<li class="next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></li>
              				</ul>
    
    						<?php endwhile; // end of the loop. ?>
                            <?php endif; ?>
                        </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘the_content() in single.php’ is closed to new replies.