Change the default WP Job Manager file upload directory

functions.phpadd_filter( ‘job_manager_upload_dir’, ‘my_custom_job_manager_upload_dir’ ); function my_custom_job_manager_upload_dir( $job_manager_uploading_file ) { // This is the default below // $dir = ‘job-manager-uploads/’ . $job_manager_uploading_file; // This is using a custom directory, make sure to add $job_manager_uploading_file to the end of the string $dir = ‘custom_jm_uploads/’ . $job_manager_uploading_file; return $dir; }

How to set Job Category from another custom Taxonomy when using WP Job Manager Field Editor

functions.php<?php add_action( ‘job_manager_field_editor_save_custom_field_end’, ‘update_my_custom_tax_field_editor_fields’, 10, 5 ); /** * Update Listing job_category from job_category_dentist taxonomies * * REQUIRES: WP Job Manager Field Editor 1.4.2+ * * This can be useful if you want to set the Job Category but for some reason have that field hidden, * disabled, or set to not show for a […]

Update WP Job Manager Field on Save or Update (For saving value when used with Action Hook field type)

functions.php<?php /* * Save/Update Listing when Save/Update from Frontend */ add_action( ‘job_manager_update_job_data’, ‘smp920_update_my_fields’, 100, 2 ); function smp920_update_my_fields( $job_id, $values ){ // Check for value in $_POST, then set var with sanitized value, CHANGE my_input_name to the NAME used in the input HTML element $my_input_name = isset( $_POST[‘my_input_name’] ) ? sanitize_text_field( $_POST[‘my_input_name’] ) : false; […]

WordPress wp_dropdown_posts() function. Based off wp_dropdown_users() and wp_dropdown_pages() (EDIT MOVED TO REPO: https://github.com/tripflex/wp_dropdown_posts )

wp-dropdown-posts.php<?php // Exit if accessed directly if( ! defined( ‘ABSPATH’ ) ) exit; if( ! function_exists( ‘wp_dropdown_posts’ ) ) { /** * Create dropdown HTML content of posts * * The content can either be displayed, which it is by default or retrieved by * setting the ‘echo’ argument. The ‘include’ and ‘exclude’ arguments do […]

Foreach PHP loop to customize output of taxonomy or field that is saved as an array

content-single-job_listing.php<?php $sh_indoor_outdoor = get_job_field( ‘indoor_outdoor’ ); if( is_array( $sh_indoor_outdoor ) && ! empty( $sh_indoor_outdoor ) ){ foreach( $sh_indoor_outdoor as $value ){ // Go to next item if $value is an empty string, 0, false, or empty array if( empty( $value ) ) continue; // This switch statement checks the value to see what the class […]

WP Job Manager Job List Custom Sort by Meta Field Value

functions.php<?php // https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters function xyz_custom_orderby( $query_args ) { // Use meta_value_num for numeric sorting (if issues with meta_value) $query_args[ ‘orderby’ ] = ‘meta_value’; $query_args[ ‘order’ ] = ‘ASC’; return $query_args; } add_filter( ‘job_manager_get_listings_args’, ‘xyz_custom_orderby’, 99 ); function xyz_custom_orderby_query_args( $query_args ) { $query_args[ ‘cache-bust’ ] = time(); $query_args[ ‘meta_key’ ] = ‘_job_salary’ return $query_args; } add_filter( […]

WordPress Live Templates for PhpStorm

wordpress.xml<?xml version="1.0" encoding="UTF-8"?> <templateSet group="WordPress"> <template name="aa" value="add_action( ‘$hook$’, ‘$callback$’ );&#10;$END$" description="add_action" toReformat="false" toShortenFQNames="true"> <variable name="hook" expression="" defaultValue="" alwaysStopAt="true" /> <variable name="callback" expression="" defaultValue="" alwaysStopAt="true" /> <context> <option name="HTML_TEXT" value="false" /> <option name="HTML" value="false" /> <option name="XSL_TEXT" value="false" /> <option name="XML" value="false" /> <option name="SQL" value="false" /> <option name="JSP" value="false" /> <option name="CSS_PROPERTY_VALUE" value="false" /> […]