/** * output_job function. * * @access public * @param array $args * @return string */ public function output_job($atts) { extract(shortcode_atts(array('id' => ''), $atts)); if (!$id) { return; } ob_start(); $args = array('post_type' => 'jobpost', 'post_status' => 'publish', 'p' => $id); $jobs = new WP_Query($args); if ($jobs->have_posts()) { ?> <?php while ($jobs->have_posts()) { $jobs->the_post(); ?> <h1><?php the_title(); ?> </h1> <?php get_simple_job_board_template_part('content-single', 'job-listing'); ?> <?php } ?> <?php } wp_reset_postdata(); return '<div class="job-shortcode single-job-listing">' . ob_get_clean() . '</div>'; }
} 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'); get_simple_job_board_template('job-filters.php'); if ($wp_query->have_posts()) { do_action('sjb_before_jobpost_loop'); get_simple_job_board_template('content-job-listing-start.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
get_header('jobs'); /** * sjb_before_main_content hook * * @hooked sjb_job_listing_wrapper_start - 10 (outputs opening divs for the content) */ do_action('sjb_before_main_content'); ?> <div class="container"> <div class="sjb-row"> <h2 id="job-title"><?php echo apply_filters('sjb_single_job_detail_page_title', get_the_title()); ?> </h2> </div> </div> <?php while (have_posts()) { the_post(); get_simple_job_board_template_part('content-single', 'job-listing'); } // end of the loop. /** * sjb_after_main_content hook * * @hooked sjb_job_listing_wrapper_end - 10 (outputs closing divs for the content) */ do_action('sjb_after_main_content'); get_footer('jobs');
/** * Add extra content when showing job content */ public function job_content($content) { global $post; if (!is_singular('jobpost') || !in_the_loop()) { return $content; } remove_filter('the_content', array($this, 'job_content')); if (is_single() and 'jobpost' === $post->post_type) { ob_start(); do_action('job_content_start'); get_simple_job_board_template_part('content-single', 'job-listing'); do_action('job_content_end'); $content = ob_get_clean(); } add_filter('the_content', array($this, 'job_content')); return apply_filters('simple_job_board_single_job_content', $content, $post); }