|
Server IP : 10.106.20.8 / Your IP : 216.73.216.148 Web Server : Apache System : Linux webm008.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : sixiemesrc ( 611999) PHP Version : 8.0.30 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/sixiemesrc/new/wp-content/themes/gaaga/modules/search/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
add_action( 'gaaga_after_main_css', 'search_style' );
function search_style() {
wp_enqueue_style( 'gaaga-quick-search', get_theme_file_uri('/modules/search/assets/css/search.css'), false, GAAGA_THEME_VERSION, 'all');
}
add_action('wp_ajax_gaaga_search_data_fetch' , 'gaaga_search_data_fetch');
add_action('wp_ajax_nopriv_gaaga_search_data_fetch','gaaga_search_data_fetch');
function gaaga_search_data_fetch(){
$search_val = gaaga_sanitization($_POST['search_val']);
$the_query = new WP_Query( array( 'posts_per_page' => 5, 's' => $search_val, 'post_type' => array('post', 'product') ) );
if( $the_query->have_posts() ) :
while( $the_query->have_posts() ): $the_query->the_post(); ?>
<li class="quick_search_data_item">
<a href="<?php echo esc_url( get_permalink() ); ?>">
<?php the_post_thumbnail( 'thumbnail', array( 'class' => ' ' ) ); ?>
<?php the_title();?>
</a>
</li>
<?php endwhile;
wp_reset_postdata();
else:
echo'<p>'. esc_html__( 'No Results Found', 'gaaga') .'</p>';
endif;
die();
}
?>