/** * jobs_listing function. * * @access public * @param mixed $args * @return void */ public function jobs_listing($atts) { // Shortcode Default Array $a = shortcode_atts(array('posts' => '-1', 'excerpt' => 'yes', 'category' => '', 'type' => '', 'location' => '', 'keywords' => '', 'order' => 'DESC'), $atts); // Job Search Filter Check if (isset($_GET['selected_category']) || isset($_GET['selected_jobtype']) || isset($_GET['selected_location'])) { $args = array('posts_per_page' => $a['posts'], 'post_type' => 'jobpost'); // Merge $arg array on each $_GET element if (isset($_GET['selected_category']) && -1 != $_GET['selected_category']) { $args = array_merge($args, array('jobpost_category' => $_GET['selected_category'])); } if (isset($_GET['selected_jobtype']) && -1 != $_GET['selected_jobtype']) { $args = array_merge($args, array('jobpost_job_type' => $_GET['selected_jobtype'])); } if (isset($_GET['selected_location']) && -1 != $_GET['selected_location']) { $args = array_merge($args, array('jobpost_location' => $_GET['selected_location'])); } if (!empty($_GET['search_keywords'])) { $args = array_merge($args, array('s' => sanitize_text_field($_GET['search_keywords']))); } } else { $args = array('posts_per_page' => $a['posts'], 'post_type' => 'jobpost', 'jobpost_category' => $a['category'], 'jobpost_job_type' => $a['type'], 'jobpost_location' => $a['location']); } $search_result = query_posts($args); get_simple_job_board_template('job-filters.php', array('per_page' => $a['posts'], 'order' => $a['order'], 'categories' => $a['category'], 'job_types' => $a['type'], 'atts' => $atts, 'location' => $a['location'], 'keywords' => $a['keywords'])); if (have_posts()) { get_simple_job_board_template('job-listings-start.php'); while (have_posts()) { the_post(); get_simple_job_board_template_part('content', 'job-listing'); } get_simple_job_board_template('job-listings-end.php'); } else { get_simple_job_board_template('content-no-jobs-found.php'); } $html = ob_get_clean(); wp_reset_query(); return $html; }
/** * Output Wrapper end div's * * @since 2.2.0 */ function sjb_job_listing_wrapper_end() { get_simple_job_board_template('wrapper-end.php'); }
while ($wp_query->have_posts()) { $wp_query->the_post(); if ('grid-view' === get_option('job_board_listing_view')) { get_simple_job_board_template_part('content', 'job-listing-grid-view'); } else { get_simple_job_board_template_part('content', 'job-listing-list-view'); } } // end of the loop. get_simple_job_board_template('content-job-listing-end.php'); get_simple_job_board_template('job-pagination.php'); do_action('sjb_after_jobpost_loop'); } else { get_simple_job_board_template('content-no-jobs-found.php'); } get_simple_job_board_template('job-listings-end.php'); wp_reset_query(); ?> <?php } /** * sjb_after_main_content hook * * @since 2.2.0 * * @hooked sjb_job_listing_wrapper_end - 10 (outputs opening divs for the content) */ do_action('sjb_after_main_content'); ?>
</div> <?php } else { ?> <?php /** * single_job_listing_start hook * * @hooked job_listing_meta_display - 20 * @hooked job_listing_company_display - 30 */ do_action('single_job_listing_start'); ?> <div class="job-description"> <?php echo apply_filters('the_job_description', get_the_content()); ?> </div> <?php /** * single-job-listing-end hook */ do_action('single_job_listing_end'); ?> <?php get_simple_job_board_template('job-application.php'); ?> <?php } ?> </div>
/** * Displays job features data on the single job page */ function job_listing_features() { get_simple_job_board_template('job-features.php', array()); }
/** * jobs_listing function. * * @access public * @param mixed $args * @return void */ public function jobs_listing($atts) { ob_start(); global $wp_query; // Shortcode Default Array $a = shortcode_atts(apply_filters('sjb_output_jobs_defaults', array('posts' => '15', 'excerpt' => 'yes', 'category' => '', 'type' => '', 'location' => '', 'keywords' => '', 'order' => 'DESC', 'search' => 'true'), $atts), $atts); if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } $args = apply_filters('sjb_output_jobs_args', array('posts_per_page' => $a['posts'], 'post_type' => 'jobpost', 'jobpost_category' => $a['category'], 'jobpost_job_type' => $a['type'], 'jobpost_location' => $a['location'], 'paged' => $paged), $atts); // Merge $arg array on each $_GET element if (isset($_GET['selected_category']) && -1 != $_GET['selected_category']) { $args['jobpost_category'] = sanitize_text_field($_GET['selected_category']); } if (isset($_GET['selected_jobtype']) && -1 != $_GET['selected_jobtype']) { $args['jobpost_job_type'] = sanitize_text_field($_GET['selected_jobtype']); } if (isset($_GET['selected_location']) && -1 != $_GET['selected_location']) { $args['jobpost_location'] = sanitize_text_field($_GET['selected_location']); } if (!empty($_GET['search_keywords'])) { $args['s'] = sanitize_text_field($_GET['search_keywords']); } $wp_query = new WP_Query($args); get_simple_job_board_template('job-listings-start.php'); if ('false' != $a['search'] && '' != $a['search']) { get_simple_job_board_template('job-filters.php', array('per_page' => $a['posts'], 'order' => $a['order'], 'categories' => $a['category'], 'job_types' => $a['type'], 'atts' => $atts, 'location' => $a['location'], 'keywords' => $a['keywords'])); } if ($wp_query->have_posts()) { /** * Add new section before job listing * * @since 2.2.0 */ do_action('sjb_job_listing_before'); global $counter; $counter = 1; while ($wp_query->have_posts()) { $wp_query->the_post(); if ('grid-view' === get_option('job_board_listing_view')) { get_simple_job_board_template_part('content', 'job-listing-grid-view'); } else { get_simple_job_board_template_part('content', 'job-listing-list-view'); } } /** * Action-> Add new section after job listing * * @since 2.2.0 */ do_action('sjb_job_listing_after'); get_simple_job_board_template('job-pagination.php'); } else { get_simple_job_board_template('content-no-jobs-found.php'); } get_simple_job_board_template('job-listings-end.php'); $html = ob_get_clean(); wp_reset_query(); return apply_filters('sjb_job_listing_shortcode', $html); }