Ok I found this code it’s working with it, but I have an issue that I am using ACF (Advanced Custom Field) and get the value from it, to show the jobs regarding tag. How I add in this code. As you can see that i am using job_tag, this is ACF value.
Wordking Code:
<?php
$args = array( 'posts_per_page' => 3 );
// the query
$sec_query = new WP_Query( $args );
?>
<?php if ( $sec_query->have_posts() ) : ?>
<?php while ( $sec_query->have_posts() ) : $sec_query->the_post(); ?>
<?php get_template_part('includes/job-loop'); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else: ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
<?php endif; ?>
My Code:
<?php $count = 1; ?>
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$args = get_post_meta($post->ID, 'job_tag', true);
$wp_query->query('tag='.$args.'&posts_per_page=12&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<?php get_template_part('includes/job-loop'); ?>
<?php if ($count == 6) : ?>
(MY AD CODE)
<?php endif; $count++; ?>
<?php endwhile; ?>