"Get posts filter by category wordpress"
Bootstrap 4.1.1 Snippet by anmolv886

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Create your snippet's HTML, CSS and Javascript in the editor tabs</h2> </div> </div>
add_shortcode("allJobs","allJobsPost"); function allJobsPost(){ $terms = get_terms( array( 'taxonomy' => 'countries', 'hide_empty' => true, ) ); ob_start(); ?> <div class="allJobs jobListing__wrapper"> <div id="tabs"> <ul> <?php if ( ! empty( $terms ) && is_array( $terms ) ) { foreach ( $terms as $term ) { ?> <li> <a href="#<?php echo $term->slug; ?>"><?php echo $term->name; ?></a> </li> <?php } } ?> </ul> <?php if ( ! empty( $terms ) && is_array( $terms ) ) { foreach ( $terms as $term ) { ?> <div id="<?php echo $term->slug; ?>"> <?php $args = new WP_Query( array( 'post_type' => 'jobs', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array( array ( 'taxonomy' => 'countries', 'field' => 'term_id', 'terms' => array($term->term_id), ) ), )); while ( $args->have_posts() ) : $args->the_post(); ?> <div class="allJobs__items jobListing__wrapper-item"> <div class="jobListing__wrapper-top"> <div class="mediaWrap d-flex flex-wrap align-items-center justify-content-between"> <a href="#" class="d-flex align-items-center"> <div class="mediaWrap__icon"> <?php the_post_thumbnail(); ?> </div> <div class="mediaWrap__content"> <h5><?php echo the_title(); ?></h5> <?php if( get_field('company_name_jobs') ): ?> <p><?php the_field('company_name_jobs'); ?></p> <?php endif; ?> </div> </a> <?php if( get_field('job_type_jobs') ): ?> <aside> <?php the_field('job_type_jobs'); ?> </aside> <?php endif; ?> </div> <ul class="d-flex flex-wrap"> <?php if( get_field('job_location_jobs') ): ?> <li> <i class="fa-solid fa-location-dot"></i> <span><?php the_field('job_location_jobs'); ?></span> </li> <?php endif; ?> <li> <i class="fa-solid fa-calendar-days"></i> <span><?php echo get_the_date();?></span> </li> <?php if( get_field('job_salary_jobs') ): ?> <li> <i class="fa-solid fa-database"></i> <span><?php the_field('job_salary_jobs'); ?></span> </li> <?php endif; ?> </ul> </div> <div class="jobListing__wrapper-btm"> <?php if( get_field('job_experience_jobs') ): ?> <p>Experience : <?php the_field('job_experience_jobs'); ?></p> <?php endif; ?> <div class="d-flex flex-wrap align-items-center justify-content-between"> <?php if( get_field('job_skills_jobs') ): ?> <?php the_field('job_skills_jobs'); ?> <?php endif; ?> <a href="https://advantf.com/newone/submit-cv" class="btnLink"> Apply Now <i class="fa-solid fa-angles-right"></i> </a> </div> </div> </div> <?php endwhile; wp_reset_query(); ?> </div> <?php } } ?> </div> </div> <?php return ob_get_clean(); }

Related: See More


Questions / Comments: