• Dan777

    (@dan777)


    Hello,

    How to crate a simple filter like in the image for tempera theme to show up posts that are in that category with thees parameters? How do you make one??

    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Dan777

    (@dan777)

    Guys, help!
    What is required for a filter to search between 3 categories with special boxes where the use can pick how many rooms, the price range etc?

    With what to start?

    WPDeveloper

    (@wpcoderpro)

    From your second post, it looks like “rooms”, “price range” etc. are your meta fields. Am I correct? If so, you can perform search with WP_Query on meta-field values.

    On the other hand, you’ve another alternative of performing direct query using global $wpdb. Build your query string and fire the SQL query.

    I hope this helps.

    webbrewers

    (@webbrewers)

    WP Custom Search plug in will search custom fields.
    Example ?
    I may not have the exact plug in name right………..

    Thread Starter Dan777

    (@dan777)

    Thank you for you’re time guys, appreciate it!

    WPDeveloper – using meta fields is okay? For a example if I have a product in a post and the meta price is listed – using the meta box the user will be able to find that product entering the meta key price correct?

    But how to get 2 boxes for price range – from, till?

    webbrewers – a plugin would be great, don’t know what exactly am i looking for – meta search?
    Sorry if I sound ridiculous.

    Thread Starter Dan777

    (@dan777)

    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' ) );

    The plug in I used is WP Custom Search.
    I added custom fields for property attributes and then created a search which looks at those custom fields. The search function has normal operators like equal to/greater than etc so it returns results based on statements like:
    “bedroooms” “are equal to” “2” etc.

    Thread Starter Dan777

    (@dan777)

    and then created a search which looks at those custom fields

    How do you crate such a search?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search filter for tempera’ is closed to new replies.