Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have big trouble with the_content() for single.php.

Whats my problem?

  • the_content() doesn't give any output on single pages
  • furthermore it crashes (no other PHP code below the function call is executed
  • There are no PHP or database errors shown
  • On all other page and post types the_content() works

What I have done/checked so far

  • deactivated all plugings -> no success
  • used original Wordpress themes -> no success
  • checked twice if the_content() is inside the loop -> it is inside
  • tried to use $post->post_content -> gives output, but I want to use the_content()
  • $textt = get_the_content(); echo $textt; -> Works also, so where's the difference between get_the_content and the_content, which keeps the_content from working as supposed to

So it seems that the problem is theme and plugin independent. I use Wordpress 3.8 and also tried to reinstall the via the update function.

share|improve this question
    
Do you have WP_DEBUG enabled? Check server logs, sometimes PHP gets confused so bad it crashes Apache before it can generate error. –  Rarst Jan 8 at 20:56

1 Answer 1

the_content( ); vs get_the_content(); The different is pretty simple actually. If you find yourself annoyed with formatting of the content, more specifically the added p-tags that WordPress puts into the content that you didn’t. Just use get_the_content(); and you will remove those tags.

Normally the get_the_content() tag returns the content WITHOUT formatting. Only the_content() will print the content WITH formatting.

echo apply_filters('the_content', $post->post_content);

share|improve this answer
    
Yeah, but I want to use the_content(). I asked for the difference to find the point, which keeps the_content() from working correctly. So also apply_filters('the_content') is broken. So I think if I could get the "the_content" filter fixed, the_content() would also work again. But I have no idea how to fix it. –  netblognet Jan 8 at 10:42
    
use this code pass second perimeter value. echo apply_filters('the_content', $post->post_content); –  ravi patel Jan 8 at 10:46
    
Unfortunaely this doesn't work, because the 'the_content' filter is broken. But I don't know why. Wordpress is freshly installed and even with twentyforteen theme and no plugins it doesn't work for single page. For main page and pages it does work. –  netblognet Jan 8 at 11:02
    
This code is worked on 3.8 theme fourteen in single.php so your code in mistake please add your code. –  ravi patel Jan 8 at 11:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.