• Resolved swessey

    (@swessey)


    So I have a single.php with the post loop etc and all that, Though when I run the page only displays <?php the_content(); ?> and nothing else. Below is the single.php code. Anyone have an Idea why this isn’t working?

    <?php get_header(); ?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div id="colorlib-main">
      <div class="colorlib-blog">
        <div class="container-wrap">
          <div class="row">
            <div class="col-md-9">
              <div class="content-wrap">
    
                <article class="animate-box">
                  <!-- <div class="blog-img" style="background-image: url(images/blog-1.jpg);"></div> -->
                  <?php the_post_thumbnail('full'), array('class' => 'blog-img'); ?>
                  <?php // NOTE: , array('class' => '') ?>
                  <div class="desc">
                    <div class="meta">
                      <p>
                        <span><?php  ?></span>
                        <span><?php the_time('F j, Y'); ?></span>
                        <span><?php the_author_posts_link(); ?> </span>
                        <!-- <span><a href="#">3 Comments</a></span> -->
                      </p>
                    </div>
                    <h2><a href="./"><?php the_title(); ?></a></h2>
                    <?php the_content(); ?>
                  </div>
                </article>
                <div class="row row-bottom-padded-md">
                  <div class="col-md-12 animate-box">
    
                    <?php comments_template(); ?>
    
                </div>
    
    <?php endwhile; endif; ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Do you mean that it doesn’t display, the header, the sidebar, the footer, or the comments?

    You are not closing any of the following <div>s here: Are they supposed to be closed in another file? If so, the error may lie in one of those files. (This happens a lot with php.)

    <div id="colorlib-main">
      <div class="colorlib-blog">
        <div class="container-wrap">
          <div class="row">
            <div class="col-md-9">
              <div class="content-wrap">
    

    Also,

    <?php // NOTE: , array('class' => '') ?> and <span><?php ?></span> aren’t doing anything.

    Thread Starter swessey

    (@swessey)

    1. What I mean is that in the loop ONLY the content function displays not even the other divs that should display.
    2. All the divs are clossed in the footer.php
    3, Yes The <span is a work in progress for me to display tags and the note is for me to add classes if they were needed in the nav menu. Just some note for me. ??

    Thread Starter swessey

    (@swessey)

    I located the problem: It displays stuff from the index.php file.

    <?php get_header(); ?>

    <div class="container">

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php the_title(); ?>
    <?php the_content(); ?>

    <?php endwhile; else: ?>

    <p>Sorry, no page found.</p>

    <?php endif; ?>

    </div>

    <?php get_footer(); ?>
    here is the page & before I only had the <?php the_content(); ?>
    so therefore it only displayed <?php the_content(); ?>
    on the post. Anyone have an idea why it doesn’t display the single.php?

    • This reply was modified 6 years, 7 months ago by swessey. Reason: Changed it bc the first edit was unclear
    • This reply was modified 6 years, 7 months ago by swessey.
    Thread Starter swessey

    (@swessey)

    So the thing I just found out is that I accidentally put single.php in a subfolder…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘single.php only displays the_content() function’ is closed to new replies.