I must display search engine results arranged by publish type. I've regular posts, pages, along with a custom publish kind of product. Wouldso would I make this happen by editing the below code. The code below just shows all posts and pages at this time.
<?php while (have_posts()) : the_post(); echo "<h1>"; echo $post->post_type; echo $post->post_title; echo "</h1>"; endwhile; ?>
You have to affect the publish query to reorder things. You'd execute this right before one enters the loop. Read much more about query_posts within the Wordpress codex.
global $wp_query; $args = array_merge( $wp_query->query, array( 'post_type' => array('type1', 'type2') ) ); query_posts( $args ); //the loop
This site has got the answer I desired : http://deadlyhifi.posterous.com/separate-posts-and-pages-in-wordpress-search.