• So I am trying to start with a custom theme and work through creating pieces of it. I feel I have messed up some where as my index links to single.php and they post doesnt show the content. I managed to get the thumbnail but maybe this should be set to featured? Not sure that matters.

    The Date, Author, and Post content do not show. What am I missing…

    Code for single.php

    <?php get_header(); ?>
    
    <p>Single.php</p>
    
    <div class="container">
    	<div class="row">
    		
    		<div class="jumbotron">
    
            <div class="container">
    
                <h1 class="blog-title"><?php bloginfo( 'name' ); ?></h1>
        
                <?php $description = get_bloginfo( 'description', 'display' ); ?>
        
                <?php if($description) { ?><p class="lead blog-description"><?php echo $description ?></p><?php } ?>
    
            </div>
    
        </div>
    		<div class="col-sm-8 blog-main">
    		<article id="post-<?php the_ID(); ?>" <?php post_class("block"); ?> role="article">
    
                <div class="blog-post">
                <h2 class="blog-post-title"><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h2>
                <p class="blog-post-meta"><?php the_date(); ?> by <?php the_author(); ?></p>
                <?php ( the_post_thumbnail( 'category-thumb600' )) ?>
                <?php the_content(); ?>
            </div><!-- /.blog-post -->
    
            </article>
    		</div><!--col-sm-8 blog-main -->
    	
    		<?php get_sidebar("left"); ?>
    		<?php get_sidebar("right"); ?>
    	
    	
    	</div> <!--row --> 
    </div> <!-- /container -->
    <?php get_footer(); ?>

    https://gist.github.com/Firejumper1000/8ba53f60db0e2ab7b148b53e0b636b07

    Index.php
    Working fine, reference to content working.

    <?php get_header(); ?>
    
    <div class="container">
    
        <div class="row">
    
        <div class="jumbotron">
    
            <div class="container">
    
            <h1 class="blog-title"><?php bloginfo( 'name' ); ?></h1>
    
            <?php $description = get_bloginfo( 'description', 'display' ); ?>
    
            <?php if($description) { ?><p class="lead blog-description"><?php echo $description ?></p><?php } ?>
    
            </div>
    
        </div>
    
        <div class="col-sm-8 blog-main">
    
            <article>
    
            <p>index.php updated</p>
            <?php if ( have_posts() ) { while ( have_posts() ) : the_post(); ?>
            <div class="blog-post">
                <h2 class="blog-post-title"><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h2>
                <p class="blog-post-meta"><?php the_date(); ?> by <?php the_author(); ?></p>
                <?php ( the_post_thumbnail( 'category-thumb600' )) ?>
                <?php the_content(); ?>
            </div><!-- /.blog-post -->
            <?php endwhile; } ?>
    
                <hr>
    
                <nav>
                <ul class="pager">
                    <li><?php next_posts_link('Previous'); ?></li>
                    <li><?php previous_posts_link('Next'); ?></li>
                </ul>
                </nav>
    
                <?php wp_reset_postdata(); ?>
    
            </article>
    
            </div><!--col-sm-8 blog-main -->
    
            <div class="blog-sidebar">
    
                <?php get_sidebar(); ?>
    
            </div><!-- /.blog-sidebar -->
    
        </div> <!--row --> 
    
    </div> <!-- /container -->
    
    <div id="scroll-top"><a href="#"><i class="fa fa-chevron-up fa-3x"></i></a></div>
    
     <?php get_footer(); ?>

    https://gist.github.com/Firejumper1000/80110107fa021fb5271a0dd4b537352f

    • This topic was modified 6 years, 10 months ago by cman18.
    • This topic was modified 6 years, 10 months ago by cman18.
    • This topic was modified 6 years, 10 months ago by cman18.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • the code for the loop is missing in your single.php template.

    Thread Starter cman18

    (@cman18)

    Thank so much for the quick response!

    The more I work with WordPress… The less I understand ??

    I got it working by pasting the loop here:

    <div class="col-sm-8 blog-main">
    		<article id="post-<?php the_ID(); ?>" <?php post_class("block"); ?> role="article">
                    <?php 
                if ( have_posts() ) {
                	while ( have_posts() ) {
                		the_post(); 
                		//
                		// Post Content here
                		//
                	} // end while
                } // end if
                ?>
                <div class="blog-post">
                <h2 class="blog-post-title"><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h2>
                <p class="blog-post-meta"><?php the_date(); ?> by <?php the_author(); ?></p>
                <?php ( the_post_thumbnail( 'category-thumb600' )) ?>
                <?php the_content(); ?>
            </div><!-- /.blog-post -->
    
            </article>
    		</div><!--col-sm-8 blog-main -->
    • This reply was modified 6 years, 10 months ago by cman18.

    small correction:
    the loop code would generally wrap around the output or the post, in your case the <article> section;

    example for your code:

    <div class="col-sm-8 blog-main">
    
    <?php 
                if ( have_posts() ) {
                	while ( have_posts() ) {
                		the_post(); 
    ?>
    
    		<article id="post-<?php the_ID(); ?>" <?php post_class("block"); ?> role="article">
                    
                <div class="blog-post">
                <h2 class="blog-post-title"><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h2>
                <p class="blog-post-meta"><?php the_date(); ?> by <?php the_author(); ?></p>
                <?php ( the_post_thumbnail( 'category-thumb600' )) ?>
                <?php the_content(); ?>
            </div><!-- /.blog-post -->
    
            </article>
    
    <?php          	} // end while
                } // end if
    ?>
    
    		</div><!--col-sm-8 blog-main -->
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘post.php wont display content and a few other things’ is closed to new replies.