functions.phpadd_filter( ‘job_manager_packages_admin_required_packages_frontend’, ‘smyles_packages_demo_admin_require_packages’ ); function smyles_packages_demo_admin_require_packages(){ return true; }
How to use a non-standard/hidden meta field for custom permalinks
functions.php// assuming the non-standard meta key is `job_import_id` (this filter is for Admin Side) add_filter( ‘job_manager_visibility_permalink_get_field_value_job_import_id_is_hidden_meta’, ‘smyles_job_import_id_permalink_not_hidden’ ); function smyles_job_import_id_permalink_not_hidden(){ return false; } // This is for frontend handling add_filter( ‘job_manager_visibility_permalink_frontend_get_field_value_job_import_id’, ‘smyles_job_import_id_frontend’, 10, 4 ); /** * Fontend Handling * * @var $value The value that is going to be returned and used for the […]
Allow empty Listing Description (job_description) field in WP Job Manager (to prevent white screen of death)
functions.php<?php // ^ there should only be one of these at the very top of your functions.php file. // Omit the <?php above if adding this code to the bottom of your functions.php file (and one exists already at the top) // Add one filter before Field Editor to make sure required shows as disabled […]
Example WP Job Manager Emails code to add custom email templates (for developers)
functions.php/** * Filter to add Custom Theme, or Plugin templates * * If you want to add custom templates, this is the hook you should use. * Custom templates should follow the pattern below. Templates should be placed inside the ‘templates’ array key * which is an array of non-key arrays. * * For the […]
How to output value/separator for multiple (inc taxonomy) fields when not using full or value wrapper in WP Job Manager Field Editor
functions.php<?php /** * If you are using shortcode, or auto output and do not have the full AND value wrapper being output (output as value only), * you can use this code below to use something different than the regular <br /> that is output by default */ add_filter(‘field_editor_output_no_wrap_after’, ‘smyles_custom_no_wrap_after’, 10, 6); function smyles_custom_no_wrap_after( $output, […]
Allow featured_image to be set as admin only field
functions.phpadd_filter( ‘job_manager_field_editor_js_conf_meta_keys’, ‘smyles_allow_featured_image_admin_only’ ); /** * Allow featured_image to be set as admin only */ function smyles_allow_featured_image_admin_only( $config ){ // Make sure admin_only_0 is in disabled fields first (_0 added for any checkboxes) if( isset( $config[‘featured_image’], $config[‘featured_image’][‘disable_fields’] ) ){ // Flip values to array keys so we can unset admin_only_0 and still retain other values […]
Disable parent categories from being selected in taxonomy chosen dropdown for WP Job Manager Field Editor
script.jsjQuery( function($){ // To use for field other than job_region, change job_region to the meta // key of the field $( ‘#job_region > .level-0’ ).each( function ( index ) { $( this ).prop( ‘disabled’, ‘disabled’ ); }); $( ‘#job_region’ ).trigger( ‘chosen:updated’ ); });
Set featured image from first Gallery Image in Listify when using WP Job Manager Field Editor
functions.php<?php // This must be ran on priority 15 as Listify updates gallery images and featured image @ priority 12 add_action( ‘job_manager_update_job_data’, ‘smyles_listify_featured_image_from_gallery’, 15, 2 ); function smyles_listify_featured_image_from_gallery( $job_id, $values ){ if ( ! isset( $values[ ‘job’ ][ ‘gallery_images’ ] ) ) { return; } $images = $values[ ‘job’ ][ ‘gallery_images’ ]; // If gallery […]
Set a custom placeholder for WP Job Manager taxonomy dropdown field
functions.php<?php add_filter( ‘job_manager_term_select_field_wp_dropdown_categories_args’, ‘smyles_set_tax_dropdown_placeholder’ ); function smyles_set_tax_dropdown_placeholder( $args ){ $taxonomy = $args[‘taxonomy’]; switch ($taxonomy){ // Set your custom taxonomy here case ‘mycustomtaxonomy’: // Set your custom taxonomy placeholder here $args[‘show_option_none’] = __( ‘Custom taxonomy placeholder 1’ ); $args[‘option_none_value’] = ”; break; case ‘mycustomtaxonomy2’: $args[‘show_option_none’] = __( ‘Custom taxonomy placeholder 2’ ); $args[‘option_none_value’] = ”; break; […]
Create/Add an auto incrementing field whenever a new Job Listing is posted (for WP Job Manager)
functions.php<?php add_action( ‘job_manager_update_job_data’, ‘smyles_add_auto_increment_field’, 10, 2); function smyles_add_auto_increment_field( $job_id, $values ){ $meta_key = ‘_my_increment_field’; $inc_option = ‘smyles_job_auto_increment’; $already_set = get_post_meta( $job_id, $meta_key, true); $last_num = get_option( $inc_option, 0 ); if( ! $already_set ){ $next_num = (int) $last_num + 1; update_post_meta( $job_id, $meta_key, $next_num ); update_option( $inc_option, $next_num ); } }