This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function custom_job_post_type_link( $post_id, $post ) { | |
| // don't add the id if it's already part of the slug | |
| $permalink = $post->post_name; | |
| if ( strpos( $permalink, strval( $post_id ) ) ) { | |
| return; | |
| } | |
| // unhook this function to prevent infinite looping | |
| remove_action( 'save_post_job_listing', 'custom_job_post_type_link', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_shortcode('job_count_jobs','job_count_jobs'); | |
| function job_count_jobs() { | |
| $count_jobs = wp_count_posts( $post_type = 'job_listing' ); | |
| $html = ''; | |
| if ( $count_jobs ) { | |
| $count_jobs->publish; | |
| $html .= '<h2>'; | |
| $html .= $count_jobs->publish; | |
| $html .= esc_attr__( ' "TOTAL JOBS', 'jobster' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Add the Featured Company fields to the admin */ | |
| add_filter( 'job_manager_job_listing_data_fields', 'admin_add_featured_company_field' ); | |
| function admin_add_featured_company_field( $fields ) { | |
| global $post; | |
| $current_user = wp_get_current_user(); | |
| if ( $current_user->has_cap( 'manage_job_listings' ) ) { | |
| $fields['_company_featured'] = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function featured_company_register_widgets() { | |
| if ( ! class_exists( 'WP_Job_Manager_Widget' ) ) { | |
| return; | |
| } | |
| /** | |
| * Featured Companies Widget | |
| */ | |
| class WP_Job_Manager_Widget_Featured_Company extends WP_Job_Manager_Widget { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (class_exists('WP_Job_Manager_Shortcodes')) { | |
| /** | |
| * Jobster_WP_Job_Manager_Output_Jobs class. | |
| */ | |
| class Jobster_WP_Job_Manager_Output_Jobs extends WP_Job_Manager_Shortcodes { | |
| /** | |
| * __construct function. | |
| * @see add_shortcode( 'jobs', array( $this, 'output_jobs' ) ); in core plugin. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* add live job count on job search */ | |
| jQuery( document ).ready( function ( $ ) { | |
| $('div.job_listings').on('updated_results', (function(_this) { | |
| return function(event, results) { | |
| $('#titlebar .count_jobs').html(results.post_count); | |
| }; | |
| })(this)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * @see WP_Job_Manager_Ajax class line 211 wp_send_json( apply_filters( 'job_manager_get_listings_result', $result, $jobs ) ); | |
| * | |
| */ | |
| function custom_job_manager_get_listings_result($result, $jobs) { | |
| $result['post_count'] = $jobs->found_posts; | |
| return $result; | |
| } | |
| add_filter( 'job_manager_get_listings_result', 'custom_job_manager_get_listings_result',10,2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h2 id="titlebar">Showing <span class="count_jobs"></span> Jobs</h2> | |
| <ul class="job_listings"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * WP_Job_Manager_Form_Register class. | |
| */ | |
| class WP_Job_Manager_Form_Register extends WP_Job_Manager_Form { | |
| public static $form_name = 'register'; | |
| protected static $job_id; | |
| protected static $preview_job; | |
| protected static $steps; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Remove Class Filter Without Access to Class Object | |
| * | |
| * In order to use the core WordPress remove_filter() on a filter added with the callback | |
| * to a class, you either have to have access to that class object, or it has to be a call | |
| * to a static method. This method allows you to remove filters with a callback to a class | |
| * you don't have access to. | |
| * | |
| * Works with WordPress 1.2+ (4.7+ support added 9-19-2016) |