2017-10-01 1 views
3

Ich benutze ein Wordpress-Immobilien-Plugin für mein Projekt, das ist wpcasa, ich mache schon einige Änderungen, aber dieses Ding braucht meine Zeit, um herauszufinden.Wie wird der Standardwert im Suchformular festgelegt?

Ich denke, sie verwenden Array, um Werte/Labels auf Suchformular zu erhalten. Jeder kann mir helfen, wie man den Standardwert in ein Suchformular einfügt?

Hier ist der Code unter

$defaults = array(   
      'keyword' => array(
       'label'   => __('Keyword or Listing ID', 'wpcasa') . '…', 
       'type'   => 'text', 
       'class'   => 'width-3-4', 
       'priority'  => 10 
      ),   
      'submit' => array(
       'label'   => __('Search', 'wpcasa'), 
       'type'   => 'submit', 
       'class'   => 'width-1-4', 
       'priority'  => 20 
      ), 
      'offer' => array(
       'label'   => __('Offer', 'wpcasa'), 
       'key'   => '_price_offer', 
       'data'   => wpsight_offers(), 
       'type'   => 'select', 
       'data_compare' => '=', 
       'class'   => 'width-1-5', 
       'priority'  => 30 
      ), 
      'location' => array(
       'data'   => array(
        // wp_dropdown_categories() options 
        'taxonomy'   => 'location', 
        'show_option_none' => __('Location', 'wpcasa'), 
        'option_none_value' => '', 
        'hierarchical'  => 1, 
        'orderby'   => 'ID', 
        'order'    => 'ASC' 
       ), 
       'type'   => 'taxonomy_select', 
       'class'   => 'width-1-5', 
       'priority'  => 40 
      ), 
      'listing-type' => array(
       'data'   => array(
        // wp_dropdown_categories() options 
        'taxonomy'   => 'listing-type', 
        'show_option_none' => __('Type', 'wpcasa'), 
        'option_none_value' => '', 
        'hierarchical'  => 1, 
        'orderby'   => 'ID', 
        'order'    => 'ASC' 
       ), 
       'type'   => 'taxonomy_select', 
       'class'   => 'width-1-5', 
       'priority'  => 50 
      ), 
      $details['details_1']['id'] => array(
       'label'   => $details['details_1']['label'], 
       'key'   => '_details_1', 
       'data'   => $details['details_1']['data'], 
       'type'   => 'select', 
       'data_compare' => '>=', 
       'class'   => 'width-1-5', 
       'priority'  => 60 
      ), 
      $details['details_2']['id'] => array(
       'label'   => $details['details_2']['label'], 
       'key'   => '_details_2', 
       'data'   => $details['details_2']['data'], 
       'type'   => 'select', 
       'data_compare' => '>=', 
       'class'   => 'width-1-5', 
       'priority'  => 70 
      )   
     ); 
` 

Beispiel auf Keyword-I Stattdessen wird ein Wert HOME gesetzt wird sein Etikett zeigt.

Vielen Dank!

+0

Sie haben Ihren Code zweimal kopiert. Entfernen Sie eines der Beispiele. – alexi2

+0

@ alexi2 hab es danke :) –

+0

Der Standardwert auf Suchformular? Platzhalter? –

Antwort

0

Ich habe es jetzt sollte ich

Beispiel

'keyword' => array(
       'label'   => __('Keyword or Listing ID', 'wpcasa') . '…', 
       'type'   => 'text', 
       'class'   => 'width-3-4', 
       'default'  => 'HELLO', 
       'priority'  => 10 
      ),  

Danke für die Hilfe/Beratung 'default' => 'MyValue', fügen!

Verwandte Themen