For a post to show up after a search it needs to have a meta tag that user is searching? Or how this works?
Custom meta field or tag?
Bahh….
WP_Query:
<?php
// The Query
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset.
*/
wp_reset_postdata();
/* The 2nd Query (without global var) */
$query2 = new WP_Query( $args2 );
// The 2nd Loop
while( $query2->have_posts() ) {
$query2->next_post();
echo '<li>' . get_the_title( $query2->post->ID ) . '</li>';
}
// Restore original Post Data
wp_reset_postdata();
?>
$query = new WP_Query( array ( 'post_type' => 'product', 'orderby' => 'meta_value', 'meta_key' => 'price' ) );