Forums

the_content() not displaying (10 posts)

  1. Michael Benson
    Member
    Posted 10 months ago #

    I have created a custom page template and until recently it has worked fine displaying the page content as appropriate. But now everything on the page works, the title is displayed, the date, even the ID, but for some reason both the_content() and the_excerpt() calls return nothing.

    I have tried deactivating all the plugins to see if there was a conflict somewhere but that had no effect. I've even had a peek in the database to ensure the content was still there. I'm a little unsure as to what's gone wrong here.

    Any advice? The rest of the page displays fine it is just this particular call.

  2. garydarling
    Member
    Posted 9 months ago #

    I'm having the same problem, any resolution to this? I entered some plain text inside one of the template parts and it outputs fine, but the_content() will not produce any results.

    As a test I copies the exact files from the twentyeleven theme into my child theme, still no luck with the_content().

  3. Pete
    Member
    Posted 9 months ago #

    I'm having the same issue as well. Have either of you guys found a resolution yet?

  4. Pete
    Member
    Posted 9 months ago #

    I just found this. Try this using:

    echo $post->post_content

    instead of:

    the_content()

    It worked for me!

  5. sirtimo
    Member
    Posted 9 months ago #

    I have exactly the same problem but with a custom post type, using custom template files yes.

    Pete, your solution does show the content but all the formatting is gone. I guess this must be a bug.

    any other solutions?

  6. Pete
    Member
    Posted 9 months ago #

    hmmm...that solution worked for me in a custom template and it didn't lose any of the styling I set for it. I wonder what caused that for you? Do you mind posting any of your code?

  7. sirtimo
    Member
    Posted 9 months ago #

    Well, i can't say what has happened, but it's solved. I've deleted my custom post type, disabled my plugins, changed theme and turned it all on again, and now it's working at least.. I really can't say what has happened...

  8. Pete
    Member
    Posted 9 months ago #

    Weird...Glad it's working for you now!

  9. sirtimo
    Member
    Posted 9 months ago #

    Thanks for the prompt assistance :)

    I've been looking around a bit more, it was my plugin that created the custom post type, that had weird behaviour.

  10. Pete
    Member
    Posted 9 months ago #

    Not a problem!

Reply

You must log in to post.

About this Topic