Why isn't apply_filter('the_content') outputting anything?
As far as I know, the function that applies the main 'formatting' to the content body is wpautop(). That function should be hooked into 'the_content' by wordpress. The function does do annoying things (like mess up embed code) though and there are a lot of plugins that will unhook it from the filter stack. Try replacing your line:
<?php $content = apply_filters('the_content', $s->post_content); echo $content; ?>
with
<?php $content = wpautop($s->post_content); echo $content; ?>
If that helps then you probably have an issue of the wpautop getting unhooked somewhere.
I had the same problem. It turned out there was a function in my theme, that also filtered the content
, but had a bug in it, causing the filter to return an empty string.
So check your theme and plugins for functions that filter the_content
. In Sublime Text 2 for example you can do a quick "find in files" with ⌘/CTRL + ⇧ + F to find possible culprits.
man86,
I see you are getting the post data via $wpdb->get_results(). The thing about it is that the data is returned raw, so you need to "prepare it" before you are able to use common post functions such as the_content() (which will return the content already formatted, like you'd like it to).
How about trying this (see comments on code):
<?php query_posts('orderby=menu_order&order=asc&posts_per_page=-1&post_type=page&post_parent='.$post->ID); if(have_posts()) { while(have_posts()) { the_post(); ?><div class="page"> <?php global $wpdb; $subs = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent='$post->ID' AND post_type='page' AND post_status='publish'"); if($subs) { ?> <div class="navi"></div> <a class="naviNext"><img src="<?php bloginfo('template_url'); ?>/images/navi-next.png" alt="" /></a> <div class="scrollable"> <div class="items"> <?php foreach($subs as $post) { // <-- changed $s to $post setup_postdata($post) // <--use setup_postdata to prepare post ?> <div class="item"> <h2><?php the_title(); // <-- use "the_title() now that the data has been prepared ?></h2> <?php the_content(); // <-- use "the_content() now that the data has been prepared ?> </div> <?php } ?> </div> </div> <?php } else { the_content(); } ?></div><?php } } wp_reset_query(); ?>
Reference: http://codex.wordpress.org/Class_Reference/wpdb#Examples_5 ("Get all information on the Drafts by User 5")
Thanks, I hope that helps!
Vq.