WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Loop not displaying content in pages (5 posts)

  1. wajumino
    Member
    Posted 2 years ago #

    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.

  2. Harry
    Member
    Posted 2 years ago #

    Try:

    <?php the_content(); ?>

    Instead of:

    <?php get_the_content ?>
  3. Harry
    Member
    Posted 2 years ago #

    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.

  4. wajumino
    Member
    Posted 2 years ago #

    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.

  5. wajumino
    Member
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic