• 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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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().

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

    I just found this. Try this using:

    echo $post->post_content

    instead of:

    the_content()

    It worked for me!

    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?

    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?

    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…

    Weird…Glad it’s working for you now!

    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.

    Not a problem!

    $posts = get_posts($args);
    foreach($posts as $post) :
    setup_postdata($post);

    /*the_content()*/

    endforeach;

    In case anyone falls onto this thread. setup_postdata($post) seems to fix it.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘the_content() not displaying’ is closed to new replies.