functions.php<?php // // CUSTOM FILTER TO ADD COMMA AFTER TAXONOMY OUTPUT FOR FIELD EDITOR // // add_filter( ‘field_editor_output_no_wrap_after’, ‘mysite_check_if_need_to_output_csv’, 10, 6 ); function mysite_check_if_need_to_output_csv( $separator, $field_slug, $job_id, $field_values, $args, $single_value ){ // ADD ANY ADDITIONAL META KEYS TO USE WITH COMMAS BELOW $csv_meta_keys = array( ‘job_skill’, ‘qualification_tag’ ); // If meta key is not one […]
How to output File Upload Field Type as link with filename as label/caption through custom ShortCode
functions.php<?php add_shortcode(‘listing_custom_file_output’, ‘listing_custom_file_output_filename_link’); function listing_custom_file_output_filename_link( $atts, $content = ”){ // !! WARNING !! // When using the core WordPress `get_post_meta` you MUST prepend the meta key // with an underscore. So if the meta key was listing_custom_file, below it // needs to be _listing_custom_file $file_paths = get_post_meta( get_the_ID(), "_listing_custom_file") if( empty( $file_paths ) ) return; […]
Multiselect field editor template with Chosen support
multiselect-field.php<?php wp_enqueue_script( ‘wp-job-manager-multiselect’ ); ?> <select multiple="multiple" name="<?php echo esc_attr( isset($field[‘name’]) ? $field[‘name’] : $key ); ?>[]" id="<?php echo esc_attr( $key ); ?>" class="job-manager-multiselect" <?php if( ! empty($field[‘required’]) ) echo ‘required’; ?> data-no_results_text="<?php _e( ‘No results match’ ); ?>" data-multiple_text="<?php _e( ‘Select Some Options’ ); ?>"> <?php $no_values = isset( $field[‘value’] ) ? false : […]
How to set max selections for different term-multiselect fields (required template override)
term-multiselect-field.php<?php // You need to use this file as a template override for this to work, // for more details please see the wpjobmanager.com documentation: // https://wpjobmanager.com/document/template-overrides/ // Get selected value if ( isset( $field[‘value’] ) ) { $selected = $field[‘value’]; } elseif ( ! empty( $field[‘default’] ) && is_int( $field[‘default’] ) ) { $selected […]
Execute shortcode from field value (when using Auto Output, Widget, or Shortcode) THIS MAY CAUSE SECURITY VULNERABILITIES
functions.php<?php // ^ the <?php above should only be in your functions.php file ONCE, at the top // // This code is provided for educational purposes only // // Executing shortcodes from user input is not support or recommended as this will // allow users to input any shortcode even ones you may not want […]
Field editor output value formatted as currency (when using auto output, shortcode, or widget)
functions.php<?php // ^ the <?php above should only be in your functions.php file ONCE, at the top // The filter is field_editor_output_as_value_METAKEY // where you need to replace METAKEY with the actual meta key you want to filter the output for // …. as you can see below you can also add multiple filters using […]
Set term-multiselect field max select options for WP Job Manager (place this in your theme’s functions.php file)
functions.php<?php add_filter( ‘job_manager_chosen_multiselect_args’, ‘set_term_multiselect_max_opts’ ); function set_term_multiselect_max_opts( $args ){ $args[‘max_selected_options’] = 5; return $args; }
How to turn a WP Job Manager Field Editor standard text field into a currency field with jQuery Mask Money ( https://github.com/plentz/jquery-maskmoney )
functions.php<?php // ^ the <?php above should only be in your functions.php file ONCE, at the top … do not include <?php if you’re adding this to the end of your functions.php file // Register our jQuery MaskMoney script in WordPress (does not output, only register) add_action( ‘wp_enqueue_scripts’, ‘my_custom_register_currency_script’ ); // Call our function to […]
How to execute shortcode when used in a field
content-single-job_listing.php<?php // You should only use this code below if the field is an "admin only" field. // Using a field that is not admin only will allow any user to execute shortcodes from your site, and can cause security issues $list_related_products = get_custom_field( ‘list_related_products’ ); echo do_shortcode( $list_related_products );
Add your own custom auto output locations to WP Job Manager Field Editor auto output dropdown
functions.php<?php // Add filter to call our custom function when setting up dropdown of output locations add_filter( ‘field_editor_output_options’, ‘my_custom_output_options’, 10, 2 ); /** * Add Custom Auto Output Locations for WPJM * * This custom function will add to the end of an array, a new set of output locations * that will be visible […]