man86,
I see that you are receiving message data through $ wpdb-> get_results (). The point is that the data is returned to its original state, so you need to “prepare it” before you can use general message functions such as the_content () (which will return already formatted content as you would like it to be).
How to try this (see code comments):
<?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) { <div class="item"> <h2><?php the_title(); </div> <?php } ?> </div> </div> <?php } else { the_content(); } ?> </div> <?php } } wp_reset_query(); ?>
Link: http://codex.wordpress.org/Class_Reference/wpdb#Examples_5 ("Get all information about drafts by user 5")
Thanks, I hope this helps!
Beats
source share