the_content() is not displaying content, why?

I have a custom theme and have built a blog page where I’d like to utilize “the loop”, but get_content() is not working. Instead of displaying page content, it displays code from a template. I don’t understand why this doesn’t function properly, because get_posts(), the_time(), and the_title() all work fine… here’s what my code looks like:

   <?php get_header(); ?>


        <div id="bottom-wrapper-page">
        <div class="breadcrumbs">
        <?php if(function_exists('bcn_display'))
            {
                bcn_display();
             }?>
         </div><!--.breadcrumbs-->
         <div id="delimeter"></div>

        <!--[if IE ]><div id="ie"><![endif]-->
        <!--[if !IE]>--><div id="post"><!--<![endif]-->            

            <?php if( is_page('blog') ) { 
             $debut = 0; //The first article to be displayed

              while(have_posts()) : the_post(); ?>
               <h2><?php the_title(); ?></h2>
               <div id="bp">
             <?php
               $myposts = get_posts('numberposts=-1&offset=$debut');
             foreach($myposts as $post) :
             ?>
              <div class="bl_date"><?php the_time('d/m/y'); ?>
              </div><!--.bl_date-->
              <div class="bl_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div><!--.bl_title-->
               <div class="bl_teaser">
              <?php the_content(); ?>
                </div><!--.bl_teaser-->  
              <?php endforeach; ?>
              </div><!--#bp-->
             <?php endwhile; ?>
            <?php } else{ ?>

                <?php while ( have_posts() ) : the_post(); ?>

                <?php get_template_part( 'content', 'page' ); ?>


                <?php endwhile; // end of the loop. ?>

            <?php } ?>
        </div><!-- #post (or #ie) -->  

        <?php get_sidebar(); ?>

        <?php get_footer(); ?>  

        </div><!-- #bottom-wrapper-page -->

And my output:

Read More
03/05/12
 Cool Post 1
 /*
  Template Name: All posts
  */
   ?>
    $debut = 0; //The first article to be displayed
    ?>
    $myposts = get_posts('numberposts=-1&offset=$debut');
     foreach($myposts as $post) :
      ?>
    : 03/05/12
   Test Post
   /*
    Template Name: All posts
    */
     ?>
    $debut = 0; //The first article to be displayed
     ?>
    $myposts = get_posts('numberposts=-1&offset=$debut');
    foreach($myposts as $post) :
    ?>
     : 19/04/12
     Hello world!
    /*
    Template Name: All posts
    */
   ?>
   $debut = 0; //The first article to be displayed
    ?>
   $myposts = get_posts('numberposts=-1&offset=$debut');
     foreach($myposts as $post) :
    ?>
     :

Whatever it is, it’s messing with my css as well. I noticed he /* Template Name: All posts */, but I don’t have a template (to my knowledge) named all posts, so I don’t know where this code came from. If anyone could please lend a hand, I’d greatly appreciate it

Related posts

Leave a Reply

1 comment

  1. I think I see what’s happening here. You need to add a ; after the time –

    <?php the_time('d/m/y'); ?>
    

    Even though I’m a bit surprised you got an output at all.