Skip to content

Instantly share code, notes, and snippets.

@KZeni
Last active October 3, 2019 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KZeni/3d62fb3af3d37ad291ecc2254d544ee5 to your computer and use it in GitHub Desktop.
Save KZeni/3d62fb3af3d37ad291ecc2254d544ee5 to your computer and use it in GitHub Desktop.
ob_start();
?>
<div class="job-browse-block">
<?php
$count_posts = wp_count_posts( 'job_listing' )->publish;
$today = getdate();
//$query = new WP_Query( 'year=' . $today['year'] . '&monthnum=' . $today['mon'] . '&day=' . $today['mday'] );
$args = array(
'post_type' => 'job_listing',
'date_query' => array(
array(
'year' => $today['year'],
'month' => $today['mon'],
'day' => $today['mday'],
),
),
);
$the_query = new WP_Query( $args );
$today_posts = $the_query->found_posts;
?>
<!--<h3>Browse by Category</h3>-->
<h3><?php echo the_field('job_category_listing_title'); ?></h3>
<p><?php echo $count_posts; ?> jobs live - <?php echo $today_posts; ?> added today</p>
</div>
<?php
$taxonomy = "job_listing_category";
$terms = get_terms($taxonomy);
if ( $terms && !is_wp_error( $terms ) ){
?>
<div class="container-block">
<div class="job-list-block">
<?php foreach ( $terms as $term ) { ?>
<a href="<?php echo get_permalink(get_option('job_manager_jobs_page_id')).'?job_listing_category='.$term->slug; ?>" <?php if(isset($_GET['job_listing_category']) && $term->slug === $_GET['job_listing_category']){ echo 'class="current"'; } ?>>
<div class="job-content-block">
<div class="job-position">
<h4><?php echo $term->name; ?></h4>
<p>(<?php echo $term->count; ?> open positions)</p>
</div>
<div class="job-next">
<i class="fas fa-chevron-right"></i>
</div>
</div>
</a>
<?php } ?>
</div>
</div>
<?php
}
?>
<?php
$output = ob_get_contents();
ob_end_clean();
echo $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment