WordPress.org

Support

Support » Themes and Templates » [Resolved] Loop not displaying content in pages

[Resolved] Loop not displaying content in pages

  • I have been coding my own theme, I have coded some before (as practice of course) and am putting this one on my own site. I have used the same loop as before which worked fine, and tried multiple variations. My databases are fine but when I put <?php the_content ?> it comes out with nothing even though stuff is written within the post on the admin end. My loop or pages looks like this:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    				<h3><?php the_title(); ?></h3>
    				<p><?php get_the_content ?></p>
    			<?php endwhile; else: ?>
    			<?php endif; ?>

    thats about it, anyone got any ideas? If I put other stuff in between the paragraph tags it shows up but the actual content itself fails. This looped used to have a query to show only one post, gave the same effect.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try:

    <?php the_content(); ?>

    Instead of:

    <?php get_the_content ?>

    get_the_content is missing the parenthesis i.e. () which references the call to the function. Plus, I think get_the_content function doesn’t echo the content, it allows you to return the content for use within your php code, so best to stick with the_content() for simple outputting.

    Hope this makes sense.

    Thanks for noticing that error, I fixed it, sadly it did nothing. I turned on the TwentyEleven theme and it didn’t display the content either I think something might be wrong with my install, I will check back here if I figure it out.

    Okay I fixed it by deleting the config.php and running another install with a new table.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Loop not displaying content in pages’ is closed to new replies.