1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

edit taxonomy

Discussion in 'PHP' started by lew1s666, Oct 15, 2014.

  1. #1
    I am using wordpress plugin which has more then one taxonomies. I want to use just Type and Location. this is the code from search-function.php.

    I want to Search fields just. When I delete other it wont work. thanks



    
    <?php 
    function ar_taxonomy_dropdown( $taxonomy ) {
                    $terms = get_terms( $taxonomy );
                    if ( $terms ) {
                        $return = '<div class="searchItem"><span class="white-shadow">Listing Type:</span> <select name="meta_tax" class="input-box">'.$taxonomy;
                            $return .= '<option value=""> Any </option>';
                        foreach($terms as $term) {
                            $return .= '<option value="'.$term->slug.'">'.$term->name.'</option>';
                        }
                        $return .= '</select></div>';
                        }
                        return $return;
                    } 
    function ar_search($return = false) { 
    include ('style-search-box.php');
    $output = '
    <div class="ar-search-span"> SEARCH </div>
    <div class="ar-search-box">
            <form method="get" id="searchform" action="'. esc_url( home_url() ).'">
           
                <div class="searchItem">
               
                    <span class="white-shadow">Price:</span> 
                   
                        <select class="input-box" name="meta_price_from">
               
                            <option '.( ($_GET['meta_price_from'] == '0')? 'selected="selected"' : '').' value ="0"> Any </option>
                            <option '.( ($_GET['meta_price_from'] == '1') ? 'selected="selected"' : '' ) .' value ="1"> $0.00 - $50,000 </option>
                              <option '.( ($_GET['meta_price_from'] == '2') ? 'selected="selected"' : '' ) .' value ="2"> $50,000 - $75,000</option>
                            <option '.( ($_GET['meta_price_from'] == '3') ? 'selected="selected"' : '' ) .' value ="3"> $75,000 - $100,000</option>
                              <option '.( ($_GET['meta_price_from'] == '4') ? 'selected="selected"' : '' ) .' value ="4"> $100,000 - $125,000</option>
                            <option '.( ($_GET['meta_price_from'] == '5') ? 'selected="selected"' : '' ) .' value ="5"> $125,000 - $150,000</option>
                              <option '.( ($_GET['meta_price_from'] == '6') ? 'selected="selected"' : '' ) .' value ="6"> $150,000 - $175,000</option>
                            <option '.( ($_GET['meta_price_from'] == '7') ? 'selected="selected"' : '' ) .' value ="7"> $175,000 - $200,000</option>
                              <option '.( ($_GET['meta_price_from'] == '8') ? 'selected="selected"' : '' ) .' value ="8"> $200,000 - $250,000</option>
                            <option '.( ($_GET['meta_price_from'] == '9') ? 'selected="selected"' : '' ) .' value ="9"> $250,000 - $300,000 </option>
                              <option '.( ($_GET['meta_price_from'] == '10') ? 'selected="selected"' : '' ) .' value ="10"> $300,000 - $400,00 </option>                          
                            <option '.( ($_GET['meta_price_from'] == '11') ? 'selected="selected"' : '' ) .' value ="11"> $400,00+ </option>
                        </select>
               
                </div>';
                 
                    $output .= ar_taxonomy_dropdown('listing_type');
                   
                   
              $output .= '
             
               <div class="searchItem">
                  <span class="white-shadow">Bedrooms:</span> <select class="input-box" name="meta_bed">
                            <option '.(($_GET['meta_bed'] == '') ? 'selected="selected"' : '' ).' value =""> Any </option>
                            <option '.(($_GET['meta_bed'] == '1') ? 'selected="selected"' : '' ).'  value ="1"> 1 </option>
                              <option '.(($_GET['meta_bed'] == '2') ? 'selected="selected"' : '' ).'  value ="2"> 2</option>
                            <option '.(($_GET['meta_bed'] == '3') ? 'selected="selected"' : '' ).'  value ="3"> 3 </option>
                              <option '.(($_GET['meta_bed'] == '4') ? 'selected="selected"' : '' ).'  value ="4"> 4</option>
                            <option '.(($_GET['meta_bed'] == '5') ? 'selected="selected"' : '' ).'  value ="5"> 5+ </option>
                        </select>
                </div>
                <div class="searchItem">       
               <span class="white-shadow">Bathrooms:</span> <select class="input-box" name="meta_bath">
                            <option '.(($_GET['meta_bath'] == '') ? 'selected="selected"' : '' ).'  value =""> Any </option>
                            <option '.(($_GET['meta_bath'] == '1') ? 'selected="selected"' : '' ).' value ="1"> 1 </option>
                              <option '.(($_GET['meta_bath'] == '2') ? 'selected="selected"' : '' ).' value ="2"> 2</option>
                            <option '.(($_GET['meta_bath'] == '3') ? 'selected="selected"' : '' ).' value ="3"> 3 </option>
                              <option '.(($_GET['meta_bath'] == '4') ? 'selected="selected"' : '' ).' value ="4"> 4</option>
                            <option '.(($_GET['meta_bath'] == '5') ? 'selected="selected"' : '' ).' value ="5"> 5+ </option>
                             
                        </select>  
                </div>
                <div class="searchItemCheck">           
              <div class="fix-check">              
              <span class="white-shadow">Garage: </span><input class="tzCheckBox " type="checkbox" name="meta_garage" '.(($_GET['meta_garage'] != '')?'checked="checked"':'').' value="yes" />
              </div>
             </div>
             <div class="searchItemCheck">
              <div class="fix-check">
              <span class="white-shadow">Fireplace:</span><input type="checkbox" name="meta_fireplace" '.(($_GET['meta_fireplace'] != '')?'checked="checked"':'').' value="yes" />
              </div>
             </div>
             <div class="searchItemCheck">
              <div class="fix-check">
              <span class="white-shadow"> Pool:</span> <input type="checkbox" name="meta_pool" '.(($_GET['meta_pool'] != '')?'checked="checked"':'').' value="yes" />
              </div></div>
             <div class="searchItemCheck">
              <div class="fix-check">
              <span class="white-shadow"> Air Conditioning:</span> <input type="checkbox" name="meta_air" '.(($_GET['meta_air'] != '')?'checked="checked"':'').' value="yes" />
              </div></div>
             <div class="searchItemCheck">
              <div class="fix-check">
              <span class="white-shadow">Open House:</span> <input type="checkbox" name="meta_house" '.(($_GET['meta_house'] != '')?'checked="checked"':'').' value="yes" />
              </div></div>
             
             
               
                <input type="hidden" name="post_type" value="listing" />                        
                <input type="submit" class="white-shadow" name="submit" id="ar-submit" value="Search" />
             
             
        </form>
        </div>';
        if ($return === true) {
            return $output;
        } else {
            echo $output;
        }
    }
    
    
    PHP:


    this is code for search result php

    
    <?php
    function ar_search_results(){
    get_header();
        include ('style.php');
       
        echo '<div class="ar-listing-wrap">
       
        <h1 class="page-title">Search Results:</h1>';
       
        include ('metaURL.php');
       
        function meta_query () {
           
        }
                        echo '<div class="ar-listing-wrap">';
                        $nodeHeight= get_option('nt_listHeight');
                        $nodeWidth= get_option('nt_listWidth');
                        global $wp_query;
                        $postPage = get_option('nt_perpageListing');
                        global $wp_query;
                        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                        echo '<div class="boatGallery">';
                        query_posts( array (
                            'posts_per_page' => $postPage, 
                            'paged'=>$paged,
                            'post_type' => 'listing',
                            'meta_query' => array(
                                array(
                                    'key' => '_general_nt_logo',
                                    'value' => array($priceMin, $priceMax),
                                    'type' => 'numeric',
                                    'compare' => 'BETWEEN'
                                ),
                                array(
                                    'key' => '_general_bedroom',
                                    'value' => array($bedMin, $bedMax),
                                    'type' => 'numeric',
                                    'compare' => 'BETWEEN'
                                ),
                                array(
                                    'key' => '_general_bathroom',
                                    'value' => array($bathMin, $bathMax),
                                    'type' => 'numeric',
                                    'compare' => 'BETWEEN'
                            )),
                            $poolMeta => array(
                                array(
                                    'key' => $poolTerm,
                                    'value' => $poolValue,  
                            )),
                            $garageMeta => array(
                                array(
                                    'key' => $garageTerm,
                                    'value' => $garageValue,  
                            )),
                            $fireplaceMeta => array(
                                array(
                                    'key' => $fireplaceTerm,
                                    'value' => $fireplaceValue,  
                            )),
                            $houseMeta => array(
                                array(
                                    'key' => $houseTerm,
                                    'value' => $houseValue,  
                            )),
                            $airMeta => array(
                                array(
                                    'key' => $airTerm,
                                    'value' => $airValue,  
                            )),
                           
                           
                           
                            $queryTax => array(
                                array(
                                    $tax => 'listing_type',
                                    $slug => 'slug',
                                    $term => $taxTerm,
                                )),                               
                                       
                        )); 
                        while ( have_posts() ) : the_post();
                        $image_id = get_post_thumbnail_id();
                        $image_url = wp_get_attachment_image_src($image_id,'medium', true);   
                        $price = number_format(get_post_meta(get_the_ID(), '_general_nt_logo', true));
                        $image = str_replace("-".$image_url[1]."x".$image_url[2], "", $image_url[0]);
                        $featured = get_post_meta(get_the_ID(), 'boat-featured', true); 
                        echo '
                        <li>
                            <a href="'.get_permalink().'"><img src="'.ARURL.'/admin/thumb.php?src='.$image.'&w='.$nodeWidth.'&h='.$nodeHeight.'&q=100">
                            <div class="galDiv">
                                <div class="boatTitle">'.get_the_title().'</div>                       
                                <div class="boatPrice">'.currency ().$price.'</div>
                                <div class="boatPower"> '.get_post_meta(get_the_ID(), '_map_ar_address', true).'</div>
                            </div>
                            </a>
                        </li>';
                       
                        endwhile;  wp_reset_postdata();
                       
                echo '</div></div>';             
                echo emm_paginate();   
    }
    
    
    PHP:
     
    lew1s666, Oct 15, 2014 IP