tags:

views:

40

answers:

1

Anyone knows why the_content() doesn't show on my single.php page, while it shows up on index.php?

Thanks.

                                <div class="block">
                                    <h1><?php the_title(); ?></h1>
                                    <p class="date">
                                        <?php the_date('d F Y'); ?>
                                    </p>
                                    <p>
                                        <?php the_content(); ?>
                                    </p>
                                </div>
+1  A: 

in your single.php page nad index page the_*() functions are only designed to be used within the loop.

while(have_posts())
{
   ///the_content(); the_title(); the_post(); etc
}

//If I Used here then it would not work!
RobertPitt
why the_title and the_date show up then?
Alex
try change the_content to the_post()
RobertPitt
how on earth is the title and date showing, if there is no loop to call them?
danixd
i think its the permalink
Alex
@danixd you can still use some of the "the_*()" functions outputting content because there also used on pages as well as posts. the_title for example outside the loop in index.php will return the title for the latest topic....
RobertPitt
@RobertPitt interested, I had no idea. Thanks!
danixd