Blog Feed

Custom woocommmerce odering

<?php $top_banner =  get_field('top_banner',87);  ?>
<div class="topbanner paint-border  paint-bottom position-relative" style="background-image: url(<?php echo $top_banner['add_banner_images']; ?>);">
  <div class=" w-100 d-table h-100">
    <div class="d-table-cell w-100 h-100 align-middle">
        <div class="container">
     
    </div>
    </div>
  </div>
</div>
<section class="py-50-20">
  <div class="container">

      <div class="row">
      <div class="col-md-12 t-t text-center">
        
        <h2 class="f-56"><?php echo $top_banner['add_title']; ?></h2>
        <!-- <p class="lead text-light"><?php echo $top_banner['add_text']; ?></p> -->

       </div> 
     </div>
 
    <div class="row">
<div class="col-sm-6"> 
   <!--  <div class="filter"><h3>Filter</h3></div> -->
  </div>
 
  <div class="col-sm-6 mb-30">
    <form class="woocommerce-ordering" method="get">
  <select name="orderby" class="form-control" id="orderby">
      <!-- <option value="">Order By</option> -->
      <option value="most-recent" <?php if('most-recent' == $_GET['orderby']){ echo 'selected'; } ?>>Most Recent</option>
      <!-- <option value="date" <?php if('date' == $_GET['orderby']){ echo 'selected'; } ?>>Upload Date (newest to oldest)</option> -->
      <option value="price" <?php if('price' == $_GET['orderby']){ echo 'selected'; } ?>>Price (low to high)</option>
      <option value="price-desc" <?php if('price-desc' == $_GET['orderby']){ echo 'selected'; } ?>>Price (high to low)</option>
      <!-- <option value="date-asc" <?php if('date-asc' == $_GET['orderby']){ echo 'selected'; } ?>>Upload Date (oldest to newest)</option> -->
       <option value="popularity" <?php if('popularity' == $_GET['orderby']){ echo 'selected'; } ?>>Popularity</option>
      <option value="rating" <?php if('rating' == $_GET['orderby']){ echo 'selected'; } ?>>Highest rated</option>
    </select>
    </form>
    <!-- <select name="alltypesearch" class="form-control" id="orderby">
      <option value="">Order By</option>
      <option value="ASC" <?php if('ASC' == $_GET['orderby']){ echo 'selected'; } ?>>Order By Ascending</option>
      <option value="DESC" <?php if('DESC' == $_GET['orderby']){ echo 'selected'; } ?>>Order By descending</option>
    </select> -->
  </div>
</div>
</div>
</section>
<section class=" our_product_home py-50-20   position-relative">
<div class="container">
  <?php  
      //$alltype = $_GET['alltype'];
     // $allatrist = $_GET['allatrist'];
      $orderby = $_GET['orderby'];
      
     
   
     
   //$post_type = get_queried_object();
   // $post_type->rewrite['slug'];
   
   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
   $is_admin = current_user_can('manage_options'); 
if ($is_admin) {
$statusaray[] = "publish";
$statusaray[] = "private";
}
else
{
$statusaray[] = "publish";
}
      if(isset($orderby)){
   if($orderby == ''){
$orderby = '';
$meta_key = '';
$order = 'DESC';
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        'orderby'   => $orderby,
        'meta_key' => $meta_key,
        'order' => $order,
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
   if($orderby == 'most-recent'){
$orderby = 'date';
$meta_key = '';
$order = 'DESC';
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        'orderby'   => $orderby,
        'meta_key' => $meta_key,
        'order' => $order,
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
if($orderby == 'price'){
$orderby = 'meta_value_num';
$meta_key = '_price';
$order = 'ASC';
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        'orderby'   => $orderby,
        'meta_key' => $meta_key,
        'order' => $order,
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
if($orderby == 'price-desc'){
$orderby = 'meta_value_num';
$meta_key = '_price';
$order = 'DESC';
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        'orderby'   => $orderby,
        'meta_key' => $meta_key,
        'order' => $order,
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
if($orderby == 'popularity'){
$orderby = 'meta_value_num';
$meta_key = 'total_sales';
$order = 'DESC';
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        'orderby'   => $orderby,
        'meta_key' => $meta_key,
        'order' => $order,
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
if($orderby == 'date'){
$orderby = 'meta_value_num';
$meta_key = '';
$order = 'DESC';
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        'orderby'   => $orderby,
        'meta_key' => $meta_key,
        'order' => $order,
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
if($orderby == 'date-asc'){
$orderby = 'meta_value_num';
$meta_key = '';
$order = 'ASC';
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        'orderby'   => $orderby,
        'meta_key' => $meta_key,
        'order' => $order,
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
if($orderby == 'rating'){
$orderby = 'meta_value_num';
$meta_key = '_wc_average_rating';
$order = 'DESC';
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        'orderby'   => 'meta_value_num',
        'meta_key' => '_wc_average_rating',
        'order' => 'DESC',
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
}else{
 $args = array(
        'post_type'      => 'product',
        'posts_per_page'=> 9,
         'post_status' => $statusaray,
        //'product_cat'    => 'ourproduct',
        'paged'         => $paged,
        'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ), 
    );
}
/*if($orderby == 'ASC'){
$orderby = 'meta_value_num';
$meta_key = '';
$order = 'ASC';
}
if($orderby == 'DESC'){
$orderby = 'meta_value_num';
$meta_key = '';
$order = 'DESC';
}*/
   
    $totalcount = 1;
    $loop = new WP_Query( $args ); ?> 

    <?php  if ( $loop->have_posts() ) : ?>
       <div class="row" id="loaderpost">
       

        <?php while ( $loop->have_posts() ) : $loop->the_post(); 
           global $product; ?>
        <div class="col-lg-4 col-md-6 mb-30 price_box">
           

            <div class="popular_videos pro-iteam">
             <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>
             <a href="<?php echo the_permalink(); ?>"> 
<img class="img" src="<?php echo $image[0]; ?>" />

   <div class="text">
                 <div class="cen">     
                <h3><?php the_title();?> </h3> 
               <?php
                  $product = wc_get_product( $post_id ); 
                  $price = get_post_meta( get_the_ID(), '_sale_price', true);
                  $regular_price = get_post_meta( get_the_ID(), '_regular_price', true);
 
                 if ($price != "") {
               ?>
               <span><!-- $ --><?php //echo $price; ?></span>
             <?php } ?>


                  </div> </div>
             </a>
            
           
         </div>
           </div>

        <?php $totalcount++; endwhile; ?>

       </div>
       

    <?php endif; ?>


            
                 <div class="pt-4 col-12 text-center">
                  <div id="LoadingImage" style="display: none">
          <img src="<?php bloginfo('template_url');?>/images/loader-1.gif" />
          </div> 

         
          
           

          </div>

          
</div>
</section>

<?php
$args747744 = array(
          'post_type'      => 'product',
          'posts_per_page'=> -1,
           'post_status' => $statusaray,
          'tax_query'  => array(
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug', // Or 'name' or 'term_id'
                'terms'    => array('popular-videos', 'videos', 'events'),
                'operator' => 'NOT IN', // Excluded
            )
            ),
          //'product_cat'    => 'ourproduct'
         
      );
     $my_posts77777 = new WP_Query( $args747744 );
?>
   
<input type="hidden" id="totalcounts" value="4">


<input type="hidden" id="totalpost" value="<?php echo $my_posts77777->post_count; ?>">

<input type="hidden" id="orderbyvalue" value="<?php echo $orderby; ?>">



<input type="hidden" id="orderby1" value="<?php echo $orderby; ?>">
<input type="hidden" id="metakey1" value="<?php echo $meta_key; ?>">
<input type="hidden" id="ordetype" value="<?php echo $order; ?>">


<?php
get_footer( 'shop' );
?>


<script type="text/javascript">
 jQuery(document).ready(function($) {
jQuery('#totalcounts').val(4);
  
    var totalcounts77 =  jQuery('#totalpost').val();
    var orderbyvalue =  jQuery('#orderbyvalue').val();
    var orderby1 =  jQuery('#orderby1').val();
    var metakey1 =  jQuery('#metakey1').val();
    var ordetype =  jQuery('#ordetype').val();
   var count = 2;
   var total = totalcounts77;
   jQuery(window).scroll(function(){
        
     if (jQuery(window).scrollTop() >= 300){
     
 var totalcounts7777 =  parseInt(jQuery('#totalpost').val());
     var totalcounts11111 =  parseInt(jQuery('#totalcounts').val());
     
        if (typeof(processing) !== "undefined" && processing == true){
     console.log("reach1774");
       return false;
      }else{
          processing = true;
   
  
      if(totalcounts7777 >= totalcounts11111){
        console.log("reach");
        loadArticle(count);
      }else{
        console.log("reach1");
        return false;
         
      }
      count++;
     }
}
   });
   function loadArticle(pageNumber){
     jQuery('a#inifiniteLoader').show('fast');
      jQuery("#LoadingImage").show();
   
         if(orderbyvalue){
 var data = {
            'action': 'load_posts_by_ajax50',
            'page': pageNumber,
            'totalcount': totalcounts77,
             'ordervalue': orderbyvalue,
             'orderby1': orderby1,
             'metakey1': metakey1,
             'ordetype': ordetype,
            'security': '<?php echo wp_create_nonce("load_more_posts"); ?>'
        };
  }else{
    var data = {
            'action': 'load_posts_by_ajax',
            'page': pageNumber,
            'totalcount': totalcounts77,
            'security': '<?php echo wp_create_nonce("load_more_posts"); ?>'
        };
  }
     $.ajax({
       url: "<?php echo admin_url(); ?>admin-ajax.php",
       type:'POST',
       data: data,
       success: function (html) {
        processing = false;
        var totalcounts =  jQuery('#totalcounts').val();
        var valtwo = 4;
        var totalcountsnew = (+totalcounts) + (+valtwo);
        jQuery('#totalcounts').val(totalcountsnew);
        jQuery('#loaderpost').append(html);
        jQuery("#LoadingImage").hide();
        
       }
     });
     return false;
   }
 });
</script>

<script type="text/javascript">
   $(document).ready(function () {
    $("#alltypeartist").change(function () {
        var valv = $("#alltypeartist").val();
  var address = "http://theimpossibleco.com/product/?alltype=" + valv;
      window.location.replace(address);
    });
});
</script>

<script type="text/javascript">
    $(document).ready(function () {
    $("#artistname").change(function () {
        var alltypeartist = $("#alltypeartist").val();
        var artistname = $("#artistname").val();
     var address = "http://theimpossibleco.com/product/?alltype=" + alltypeartist + "&allatrist=" + artistname ;
      window.location.replace(address);
     });
  });
</script>

 <script type="text/javascript">
    $(document).ready(function () {
    $("#artistname").change(function () {
        var alltypeartist = $("#alltypeartist").val();
        var artistname = $("#artistname").val();
     var address = "http://theimpossibleco.com/product/?alltype=" + alltypeartist + "&allatrist=" + artistname ;
      window.location.replace(address);
     });
  });
</script>
 <script type="text/javascript">
    $(document).ready(function () {
    $("#orderby").change(function () {
        /*var alltypeartist = $("#alltypeartist").val();
        var artistname = $("#artistname").val();*/
         var orderby = $("#orderby").val();  
        
     var address = "http://theimpossibleco.com/product/?orderby=" + orderby;
      window.location.replace(address);
     });
  });
</script>

Get type Taxonomy

<?php 
    $cat_args4 = array(
        'taxonomy'               => 'product_cat',
        'orderby'                => 'name',
        'order'                  => 'ASC',
        'hide_empty'             => false,
        'include'                => array(),
        'exclude'                => array('uncategorized'),
        'exclude_tree'           => array(),
        'number'                 => -1,
        'offset'                 => '5',
        'fields'                 => 'all',
        'name'                   => '',
        'slug'                   => '',
        'hierarchical'           => true,
        'search'                 => '',
        'name__like'             => '',
        'description__like'      => '',
        'pad_counts'             => false,
        'get'                    => '',
        'child_of'               => 0,
        'parent'                 => '',
        'childless'              => false,
        'cache_domain'           => 'core',
        'update_term_meta_cache' => true,
        'meta_query'             => ''
    );
    $product_categories4 = get_terms($cat_args4 ); ?>
    <li class="more dropbtn"> <!-- <a href="#"><i class="far fa-plus"></i> More</a> -->
      <ul class="submenu">
        <?php foreach ( $product_categories4 as $term4 ) {
          $term_linkb = get_term_link( $term4 );
          $thumbnail_idb = get_woocommerce_term_meta( $term4->term_id, 'thumbnail_id', true ); 
          $imagek = wp_get_attachment_url( $thumbnail_idb ); ?>
          <li>
            <span><img src="<?php echo $imagek ?>"/></span>
            <a class="shopping-now" href="<?php esc_url( $term_linkb ); ?>"> <?php $term4->name ?></a> 
          </li>
        <?php } ?>
      </ul>
    </li>

woocommerce product Categery

<div class="prodct-listing">
<div class="container">
	<div class="row top-row">
	    <?php do_action( 'woocommerce_before_shop_loop'); ?>
	</div>

	<div class="related products">
    	<ul class="products columns-4">
	        <?php 

			woocommerce_product_loop_start();

			if ( wc_get_loop_prop( 'per_page' ) ) {

		        while ( have_posts() ):
					
					the_post();
		            
		            do_action( 'woocommerce_shop_loop' );

					wc_get_template_part( 'content', 'product' );
					
		        endwhile; 

	    	}

	        woocommerce_product_loop_end();

	        ?>
        </ul>
    </div>

	<?php do_action( 'woocommerce_after_shop_loop' ); ?>

 </div>
 </div>

wp upload multipule images

<?php 
if (!empty($_FILES['image_gallery']['name'][0])) {

        require_once( ABSPATH . 'wp-admin/includes/image.php' );
        require_once( ABSPATH . 'wp-admin/includes/file.php' );
        require_once( ABSPATH . 'wp-admin/includes/media.php' );


        $files = $_FILES['image_gallery'];
        $count = 0;
        $galleryImages = array();


        foreach ($files['name'] as $count => $value) {

            if ($files['name'][$count]) {

                $file = array(
                    'name'     => $files['name'][$count],
                    'type'     => $files['type'][$count],
                    'tmp_name' => $files['tmp_name'][$count],
                    'error'    => $files['error'][$count],
                    'size'     => $files['size'][$count]
                );

                $upload_overrides = array( 'test_form' => false );
                $upload = wp_handle_upload($file, $upload_overrides);


                // $filename should be the path to a file in the upload directory.
                $filename = $upload['file'];

                // The ID of the post this attachment is for.
                $parent_post_id = $pid;

                // Check the type of tile. We'll use this as the 'post_mime_type'.
                $filetype = wp_check_filetype( basename( $filename ), null );

                // Get the path to the upload directory.
                $wp_upload_dir = wp_upload_dir();

                // Prepare an array of post data for the attachment.
                $attachment = array(
                    'guid'           => $wp_upload_dir['url'] . '/' . basename( $filename ), 
                    'post_mime_type' => $filetype['type'],
                    'post_title'     => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
                    'post_content'   => '',
                    'post_status'    => 'inherit'
                );

                // Insert the attachment.
                $attach_id = wp_insert_attachment( $attachment, $filename, $parent_post_id );

                // Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
                require_once( ABSPATH . 'wp-admin/includes/image.php' );

                // Generate the metadata for the attachment, and update the database record.
                $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
                wp_update_attachment_metadata( $attach_id, $attach_data );

                array_push($galleryImages, $attach_id);

            }

            $count++;

            // add images to the gallery field
            update_field('gallery_images', $galleryImages, $pid);

        }



    } ?>

<input type="file" name="image_gallery[]" multiple />

wp upload Single image

$user_id = get_current_user_id();

<?php 
$title     = $_POST['title'];
$content   = $_POST['content'];
//$custom_field = $_POST['custom_1']; 
$post_type = 'portfolio';


//the array of arguements to be inserted with wp_insert_post
$new_post = array(
'post_title'    => $title,
'post_content'  => $content,
'post_status'   => 'publish',         
'post_type'     => 'portfolio',
'post_author'   => $user_id,
);

//insert the the post into database by passing $new_post to wp_insert_post
//store our post ID in a variable $pid
//we now use $pid (post id) to help add out post meta data
 $pid=wp_insert_post($new_post);
 if($pid  < 0){
        echo "Error Occured.";
    }else{

   $filename = $_FILES['featured_image']['name'];
  $wp_filetype = wp_check_filetype( basename($filename), null );
  $wp_upload_dir = wp_upload_dir();

  // Move the uploaded file into the WordPress uploads directory
  move_uploaded_file( $_FILES['featured_image']['tmp_name'], $wp_upload_dir['path']  . '/' . $filename );

  $attachment = array(
  'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ), 
  'post_mime_type' => $wp_filetype['type'],
  'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
  'post_content' => '',
  'post_status' => 'inherit'
  );

  $filename = $wp_upload_dir['path']  . '/' . $filename;

  $attach_id = wp_insert_attachment( $attachment, $filename, $attach_id);
  require_once( ABSPATH . 'wp-admin/includes/image.php' );
  $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
  wp_update_attachment_metadata( $attach_id, $attach_data );
  update_post_meta($pid, '_thumbnail_id', $attach_id);
} ?>

Filter by mata Query


<form action="" method="get">
	<select name="jobserch" id="jobserch">
		<option value="">select</option>
		<option value="BCA">BCA</option>
		<option value="MCA">MCA</option>
		<option value="CA">CA</option>
	</select>
	<input type="submit" value="filter">
</form>
<?php 

if($_GET['jobserch'] && !empty($_GET['jobserch']))
{
	$serjob = $_GET['jobserch']; 
}

  $args = array(
        'post_type' => 'post',
        'posts_per_page' => -1,
        'post_status' => 'publish',
         'meta_query'  => array(
            array(
                'key'     => 'job_type',
                'value'   =>$serjob,
               	'compare' => 'LIKE'
            )
        )
         );

$the_query = new WP_Query( $args );

if ( $the_query->have_posts() ) { ?>
    <ul class="mani-li">
    <?php while ( $the_query->have_posts() ) {
        $the_query->the_post(); ?>
        <li class="<?php the_field('job_type')?>">
       <div > 
       		<p><?php echo get_the_title(); ?></p>
            <p><?php the_field('job_type'); ?></p>
   		</div> 
       <?php  } ?>
   	</li>
   	</ul>
	<?php } ?>

<script type="text/javascript">
	jQuery('#jobserch').on('change', function() {
		var $thiss = jQuery(this).val();
		if(!$thiss){
			jQuery('.mani-li li').show();
		}else{
			jQuery('.mani-li li').hide();
			jQuery('.'+$thiss).show();
		}
		
	});	


</script>
-----------------------------------------
   <div class="career_filter_section">
          <?php 
          $job_list[] = $job_list;
          while(have_rows('career_jobs_repeater')): the_row(); 
          array_push($job_list, get_sub_field('job_type_list') );
          endwhile; 
          $single_job = array_unique($job_list);
          ?>
          <select class="form-control" id="filter-careers-type">
            <option value="All">All</option> 
            <?php foreach ($single_job as $job){ ?>
              <option value="<?php echo $job; ?>"><?php echo $job; ?></option>
            <?php } ?>
          </select>
                            
                </div>


<ul class="testk">
            <?php while(have_rows('career_jobs_repeater')): the_row();?>
            <li class="job_type" data-type="<?php the_sub_field('jobs_type');?>">
              <div class="jobs_title_left">
                <h3><a href="<?php the_sub_field('apply_now_button_url');?>"><?php the_sub_field('jobs_title');?></a>, <span><?php the_sub_field('jobs_location');?></span></h3>
                <span><?php the_sub_field('jobs_type');?></span>
              </div>
              <div class="jobs_apply_button">
                <a href="<?php the_sub_field('apply_now_button_url');?>"><?php the_sub_field('apply_now_button_title');?></a>
              </div>
            </li>
          <?php endwhile;?>
          </ul>

   <style type="text/css">
  #filter-careers-type option:empty {
    display: none;
}
</style>
<script type="text/javascript">
    $("#filter-careers-type").change(function() {
    var filterValue = $(this).val();
    var job_type = $('.job_type'); 
      
    job_type.hide()
    job_type.each(function(i, el) {
         if($(el).attr('data-type') == filterValue) {
             $(el).show();
         }
    })
<form action="" method="get">
	<select name="jobserch" id="jobserch">
		<option value="">select</option>
		<option value="BCA">BCA</option>
		<option value="MCA">MCA</option>
		<option value="CA">CA</option>
	</select>
	<input type="submit" value="filter">
</form>
<?php 

if($_GET['jobserch'] && !empty($_GET['jobserch']))
{
	$serjob = $_GET['jobserch']; 
}

  $args = array(
        'post_type' => 'post',
        'posts_per_page' => -1,
        'post_status' => 'publish',
         'meta_query'  => array(
            array(
                'key'     => 'job_type',
                'value'   =>$serjob,
               	'compare' => 'LIKE'
            )
        )
         );

$the_query = new WP_Query( $args );

if ( $the_query->have_posts() ) { ?>
    <ul class="mani-li">
    <?php while ( $the_query->have_posts() ) {
        $the_query->the_post(); ?>
        <li class="<?php the_field('job_type')?>">
       <div > 
       		<p><?php echo get_the_title(); ?></p>
            <p><?php the_field('job_type'); ?></p>
   		</div> 
       <?php  } ?>
   	</li>
   	</ul>
	<?php } ?>

<script type="text/javascript">
	jQuery('#jobserch').on('change', function() {
		var $thiss = jQuery(this).val();
		if(!$thiss){
			jQuery('.mani-li li').show();
		}else{
			jQuery('.mani-li li').hide();
			jQuery('.'+$thiss).show();
		}
		
	});	


</script>
-----------------------------------------
   <div class="career_filter_section">
          <?php 
          $job_list[] = $job_list;
          while(have_rows('career_jobs_repeater')): the_row(); 
          array_push($job_list, get_sub_field('job_type_list') );
          endwhile; 
          $single_job = array_unique($job_list);
          ?>
          <select class="form-control" id="filter-careers-type">
            <option value="All">All</option> 
            <?php foreach ($single_job as $job){ ?>
              <option value="<?php echo $job; ?>"><?php echo $job; ?></option>
            <?php } ?>
          </select>
                            
                </div>


<ul class="testk">
            <?php while(have_rows('career_jobs_repeater')): the_row();?>
            <li class="job_type" data-type="<?php the_sub_field('jobs_type');?>">
              <div class="jobs_title_left">
                <h3><a href="<?php the_sub_field('apply_now_button_url');?>"><?php the_sub_field('jobs_title');?></a>, <span><?php the_sub_field('jobs_location');?></span></h3>
                <span><?php the_sub_field('jobs_type');?></span>
              </div>
              <div class="jobs_apply_button">
                <a href="<?php the_sub_field('apply_now_button_url');?>"><?php the_sub_field('apply_now_button_title');?></a>
              </div>
            </li>
          <?php endwhile;?>
          </ul>

   <style type="text/css">
  #filter-careers-type option:empty {
    display: none;
}
</style>
<script type="text/javascript">
    $("#filter-careers-type").change(function() {
    var filterValue = $(this).val();
    var job_type = $('.job_type'); 
      
    job_type.hide()
    job_type.each(function(i, el) {
         if($(el).attr('data-type') == filterValue) {
             $(el).show();
         }
    })

    if ("All" == filterValue) {
    job_type.show();
  }
     
});

</script> 

    if ("All" == filterValue) {
    job_type.show();
  }
     
});

</script> 

mail data send by ajax

<?php 
var formdata = jQuery('form.salesforce-widget').serialize();

			jQuery.ajax({
				url: 'https://advantagegps.com/wp-admin/admin-ajax.php',
				type: 'POST',
				data:{
					action: 'send_mail_bh',
					formdata: formdata,
					slug: slug,
					title: title

				},
				success: function(response){
					//console.log(response)
					if(response=='sent'){
						jQuery('form.salesforce-widget').submit();
					}
				}
			})

                
add_action( 'wp_ajax_nopriv_send_mail_bh_ref', 'send_mail_bh_ref' );
add_action( 'wp_ajax_send_mail_bh_ref', 'send_mail_bh_ref' );

function send_mail_bh_ref() {

	$values = array();
	$suf = array();
	parse_str($_POST['formdata'], $values);
	parse_str($_POST['contectdata'], $suf);	
	  global $wpdb;
	if(!empty($suf)){

		     $us_fn = $suf['first_name'];
			 $las_ln = $suf['last_name'];
			 $company = $suf['company'];
			 $add = $suf['address'];
			 $city = $suf['city'];
			 $state = $suf['state'];
			 $zip = $suf['zip'];
			 $phone = $suf['phone'];
			 $email = $suf['email'];

$message = '';
	$message .= '<br /><strong>Self User Details:</strong> <br />';
	$message .= 'First name : '.$us_fn.'<br />';
	$message .= 'Last name : '.$las_ln.'<br />';
	$message .= 'Company : '.$company.'<br />';
	$message .= 'Address : '.$add.'<br />';
	$message .= 'City : '.$city.'<br />';
	$message .= 'State : '.$state.'<br />';
	$message .= 'Zip : '.$zip.'<br />';
	$message .= 'Phone : '.$phone.'<br />';
	$message .= 'Email : '.$email.'<br />';

	}
	else {


	//print_r($suf);

	$user_fn = $values['firstname'];
	$user_ln = $values['lastname'];
	$user_cm = $values['companyname'];
	$user_st = $values['state'];
	$user_ph = $values['phone'];
	

	$message = '';
	$message .= '<br /><strong>Self User Details:</strong> <br />';
	$message .= 'First name : '.$user_fn.'<br />';
	$message .= 'Last name : '.$user_ln.'<br />';
	$message .= 'Company : '.$user_cm.'<br />';
	$message .= 'State : '.$user_st.'<br />';
	$message .= 'Phone : '.$user_ph.'<br />';
	

	$self = $wpdb->insert('wp_ref_self',array(
		'firstname'=>$user_fn,
		'lastname'=>$user_ln,
		'companyname'=>$user_cm,
		'state'=>$user_st,
		'phone'=>$user_ph
	));

  	$lastInsertId = $wpdb->insert_id;


	foreach ($_POST['ref_form_data'] as $rfrl) {
		
		$values = array();
		parse_str($rfrl,$values);
		//print_r($values);
		
		
			$ref_fn = $values['firstname_ref'];
			$ref_ln = $values['lastname_ref'];
			$ref_cm = $values['companyname_ref'];
			$ref_st = $values['state_ref'];
			$ref_ph = $values['phone_ref'];

			$message .= '<br /><strong>Referral Details:</strong> <br />';
			$message .= 'First name : '.$ref_fn.'<br />';
			$message .= 'Last name : '.$ref_ln.'<br />';
			$message .= 'Company  : '.$ref_cm.'<br />';
			$message .= 'State : '.$ref_st.'<br />';
			$message .= 'Phone : '.$ref_ph.'<br />';

			$wpdb->insert('wp_ref_other',array(
				'firstname_ref'=>$ref_fn,
				'lastname_ref'=>$ref_ln,
				'companyname_ref'=>$ref_cm,
				'state_ref'=>$ref_st,
				'phone_ref'=>$ref_ph,
				'ref_user_id'=>$lastInsertId,
				'ref_user_name'=>$user_fn
			));

	}	



}
	


	$multiple_recipients = array(
    'ctutor@advantagegps.com',
    'referral@advantagegps.com',
    'sufiyanidea4@gmail.com',
    );


	$subject = 'A new referall on advantageGPS';

	//echo $message;

	$headers = array('Content-Type: text/html; charset=UTF-8');

	$ml = wp_mail( $multiple_recipients, $subject, $message, $headers, $attachments );

	if($ml){
		echo "sentBySufiyan";
	}

	
	/*if($self){
		echo "sentByBIlal";
	}*/


	die();
}
?>

Pagination Code

 <?php 

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

        $args = array(
          'posts_per_page'   => 12,
          'post_type'        => 'restaurant-menu',
          'order'=> 'DESC',
           'paged' => $paged,
      );
-----------------------------

  $total_pages = $wp_querys->max_num_pages;
        if ($total_pages > 1){
            $current_page = max(1, get_query_var('paged'));

            echo paginate_links(array(
                'base' => get_pagenum_link(1) . '%_%',
                'format' => '/page/%#%',
                'current' => $current_page,
                'total' => $total_pages,
                'prev_text'    => __('<i style="font-size:18px" class="fa"></i>'),
                'next_text'    => __('<i style="font-size:18px" class="fa"></i>'),
            ));
        }     
      wp_reset_postdata();
        endif; ?>

Get category

<?php 
$args = array(
    'post_type' => 'post',
    'posts_per_page' => 3,
    'offset' => 5,
    'post_status' => 'publish',
    'orderby'     => 'publish_date', 
    'order'       => 'DESC'        
  );

  $wp_querys = new WP_Query($args); ?>

<div id="Plywood" class="tabcontent"> 
    <?php 
          $args = array(
            'posts_per_page'   => -1,
            'post_type'        => 'restaurant-menu',
            'tax_query' => array(
                        array(
                            'taxonomy' => 'restaurant_category',
                            'field' => 'term_id',
                            'terms' => '7',
                        )
                    )
        );

      $wp_querys = new WP_Query($args);

      if ( $wp_querys->have_posts() ) :
      while ( $wp_querys->have_posts() ) : $wp_querys->the_post();  
          ?>
          <div class="col-sm-6 test">
          <h3 class="rq-listing-title">
            <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
                     <?php the_post_thumbnail() 
                     ?>
                    
                </div>
      <?php 
      endwhile;
      endif; 
      ?>
</div>
******************************************
<?php
		if( $terms = get_terms( array( 'taxonomy' => 'category', 'orderby' => 'name' ) ) ) : 
 
			echo '<select name="categoryfilter"><option value="">Select category...</option>';
			foreach ( $terms as $term ) :
				echo '<option value="' . $term->term_id . '">' . $term->name . '</option>'; // ID of the category as the value of an option
			endforeach;
			echo '</select>';
		endif;
	?>