как заставить автозаполнение работать на всех страницах - PullRequest
0 голосов
/ 28 января 2019

Пожалуйста, помогите.Я создаю автозаполнение.но это не работает на всех страницах.Некоторые страницы работают, некоторые страницы нет.Пожалуйста, помогите

print '
<input type="text" autocomplete="off" id="adv_location" class="form-control" name="adv_location"  placeholder="'.esc_html__('Ketik Lokasi','core').'" value="">      
                        ';


$availableTags='';
$args = array(
    'orderby' => 'count',
    'hide_empty' => 0,
); 

$terms = get_terms( 'property_city', $args );
foreach ( $terms as $term ) {
   $availableTags.= '"'.$term->name.'",';
}

$terms = get_terms( 'property_area', $args );

foreach ( $terms as $term ) {
   $availableTags.= '"'.$term->name.'",';
}

print '
<input type="text" autocomplete="off" id="adv_location" class="form-control" name="adv_location"  placeholder="'.esc_html__('Ketik Lokasi','core').'" value="">      
                        ';
                        
                        
$availableTags='';
$args = array(
    'orderby' => 'count',
    'hide_empty' => 0,
); 

$terms = get_terms( 'property_city', $args );
foreach ( $terms as $term ) {
   $availableTags.= '"'.$term->name.'",';
}

$terms = get_terms( 'property_area', $args );

foreach ( $terms as $term ) {
   $availableTags.= '"'.$term->name.'",';
}

$terms = get_terms( 'property_county_state', $args );
foreach ( $terms as $term ) {
   $availableTags.= '"'.$term->name.'",';
}

 print '<script type="text/javascript">
                       //<![CDATA[
                       jQuery(document).ready(function(){
                            var availableTags = ['.$availableTags.'];
                            jQuery("#adv_location").autocomplete({
                                source: availableTags,
                                
                                change: function() {
                                    wpestate_show_pins();
                                }
                            });
                       });
                       //]]>
                       </script>';
print '
<input type="text" autocomplete="off" id="adv_location" class="form-control" name="adv_location"  placeholder="'.esc_html__('Ketik Lokasi','core').'" value="">      
                        ';
                        
                        
$availableTags='';
$args = array(
    'orderby' => 'count',
    'hide_empty' => 0,
); 

$terms = get_terms( 'property_city', $args );
foreach ( $terms as $term ) {
   $availableTags.= '"'.$term->name.'",';
}

$terms = get_terms( 'property_area', $args );

foreach ( $terms as $term ) {
   $availableTags.= '"'.$term->name.'",';
}

$terms = get_terms( 'property_county_state', $args );
foreach ( $terms as $term ) {
   $availableTags.= '"'.$term->name.'",';
}

 print '<script type="text/javascript">
                       //<![CDATA[
                       jQuery(document).ready(function(){
                            var availableTags = ['.$availableTags.'];
                            jQuery("#adv_location").autocomplete({
                                source: availableTags,
                                
                                change: function() {
                                    wpestate_show_pins();
                                }
                            });
                       });
                       //]]>
                       </script>';
 print '<script type="text/javascript">
                       //<![CDATA[
                       jQuery(document).ready(function(){
                            var availableTags = ['.$availableTags.'];
                            jQuery("#adv_location").autocomplete({
                                source: availableTags,

                                change: function() {
                                    wpestate_show_pins();
                                }
                            });
                       });
                       //]]>
                       </script>';
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...