Field Output – sMyles Plugins https://plugins.smyl.es WordPress and WHMCS Plugins Tue, 02 Sep 2025 21:17:53 +0000 en-US hourly 1 https://wordpress.org/?v=4.6.29 How to output in WorkScout/Cariera Overview with Icons https://plugins.smyl.es/docs-kb/how-to-output-in-workscoutcariera-overview-with-icons/ Wed, 06 Jul 2022 18:27:28 +0000 https://plugins.smyl.es/?post_type=bwl_kb&p=200246 If you want to output in the “Overview” area of the WorkScout or Cariera themes, this is something supported in the Field Editor plugin, here’s how to set it up:

  • Auto output selection must be “Meta Start”, “Meta End”, or “Meta After” (meta after only for Jobs)
  • If you are using “additional outputs” the output for Overview (auto output) must be the main output (not the one selected in additional outputs)
  • Enable Full Wrapper
  • Enable Value Wrapper
  • In “Output Classes” field, enter in the Font Awesome icon classes to use (ie fas fa-phone)

https://fontawesome.com/v5/search?m=free

You may need to talk to the theme developer to find out WHAT version of Font Awesome is used in your theme, the link above is for version 5 icons.

]]>
Each Shortcode for Field Editor https://plugins.smyl.es/docs-kb/each-shortcode-for-field-editor/ Sat, 02 May 2020 22:25:18 +0000 https://plugins.smyl.es/?post_type=bwl_kb&p=181464 With the release of version 1.9.1 of the WP Job Manager Field Editor plugin, there is a new shortcode available to use for outputting multiple value field types (multiselect, repeatable, etc).

Below you can find details of this new shortcode, including the available arguments/attributes, and examples of how to use.

[each_custom_field]

This shortcode is meant for outputting any field that has “multiple” values for a single meta key (including resume repeatable fields).  The purpose of this shortcode is to allow you to customize how a multiple field value is output, using shortcodes inside a text widget or some other area of your site that supports shortcodes.

Attributes

key – required the meta key for the field you want to output

listing_id – optional if you want to output for a specific listing, use this to specify the listing ID, otherwise it will be automatically detected

Interior Shortcodes

Interior shortcodes are shortcodes that can only be used inside of the [each_custom_field] shortcode.  These allow you to output the value of the field (or value of a repeatable sub-field).  These shortcodes will not work outside of the [each_custom_field] shortcode.

[value] – will output the value of the field in the current loop (of each field value)

[each_custom_field_value] – used to loop through any resume repeatable field sub-values.  This will ONLY work for resume repeatable fields, do not try to use this for any other field type.  More details and examples can be found below.

Examples

This is a basic example using job_category:

[each_custom_field key="job_category"]
Category: [value]
[/each_custom_field]

You can also combine this with the [if_custom_field] (documentation) shortcode, to only show content when there is a value for that field (if using HTML does not work, make sure to switch to “text” to prevent editor from converting html thinking you want to “show” the HTML on the output):

[if_custom_field key="job_category"]
<ul>
[each_custom_field key="job_category"]
<li>[value]</li>
[/each_custom_field]
</ul>
[/if_custom_field]

Using with Resume Repeatable Fields

In order to use this shortcode with resume repeatable fields, you must use the [each_custom_field_value] shortcode mentioned above.  This will be used instead of the [value] shortcode, as resume repeatable fields are stored with a “key” instead of just the value like all other multiple field values are.  You will still use the [value] shotcode to output the actual value, but inside of the [each_custom_field_value]

[each_custom_field key="candidate_education"]
[each_custom_field_value key="location"]Location:[value][/each_custom_field_value]
[each_custom_field_value key="qualification"]Qualification(s):[value][/each_custom_field_value]
[each_custom_field_value key="date"]Start/end Date:[value][/each_custom_field_value]
[each_custom_field_value key="notes"]Notes:[value][/each_custom_field_value]
[/each_custom_field]
[each_custom_field key="candidate_education"]
[each_custom_field_value key="location"]Location:[value][/each_custom_field_value]
[each_custom_field_value key="qualification"]Qualification(s):[value][/each_custom_field_value]
[each_custom_field_value key="date"]Start/end Date:[value][/each_custom_field_value]
[each_custom_field_value key="notes"]Notes:[value][/each_custom_field_value]
[/each_custom_field]

When using the [each_custom_field] to output resume repeatable fields, only the values you specify with the [each_custom_field_value] will be output.  If there is no value for that specific field, nothing will be output (meaning the text inside will only be output when there is a value).

Tips and Tricks

Removing Line Breaks or Excess Spacing

By default when you use shortcodes, or a WordPress editor, it “automatically” adds paragraph tags sometimes to the output, which can result in extra line breaks.  If you want to remove this, it’s as easy as just updating your shortcode code to remove the line breaks you have in it.  My suggestion is to first make sure it outputs the values you want, then you can remove the line breaks and white space.  As example, for the basic example above, to remove the line breaks just change it to this:

[each_custom_field key="job_category"]Category: [value][/each_custom_field]

 

]]>
Admin Only Fields in Conditional Logic https://plugins.smyl.es/docs-kb/admin-only-fields-in-conditional-logic/ Wed, 11 Apr 2018 22:32:54 +0000 https://plugins.smyl.es/?post_type=bwl_kb&p=152820 As of version 1.8.1 of the Field Editor WP Job Manager addon, you can now use the filters below to allow any admin only field, or only specific ones you define … along with a default value for that field (if you want).  Version 1.8.0 or older you were able to select an admin only field, but that was only due to me overlooking those fields and making sure they weren’t selectable (see blog post for more details about this).

By default, admin only fields can NOT be selected anymore in the conditional logic configuration area.  This can easily be changed by using a filter.

Enable/Expose ALL Admin Only Fields

WARNING: this exposes all admin only field values on the frontend of your website in a JavaScript object. It is STRONGLY recommended that you ALSO use the filter below this one to ONLY output specific admin only field values.  I assume NO LIABILITY if you do not heed this warning!

add_filter( 'field_editor_conditional_logic_enable_admin_logic_fields', '__return_true' );

The above code added to your child theme’s functions.php file, or using the Code Snippets plugin, will now allow you to select from any of your configured Admin Only fields, for use in conditional logic checks.

Customize Specific Admin Only Fields to Expose/Enable

It is STRONGLY recommended that you add this filter as well, to specify ONLY what meta keys of admin only fields you want to be used for conditional logic, as to only output those values on the frontend javascript object storage:

There are two filters available for this.  One is for Jobs/Listings:

field_editor_conditional_logic_custom_value_job_admin_fields

The other is for Resumes:

field_editor_conditional_logic_custom_value_resume_admin_fields

Here’s an example using the job/listing filter:

add_filter( 'field_editor_conditional_logic_custom_value_job_admin_fields', 'smyles_logic_admin_only_job_meta_keys' );

function smyles_logic_admin_only_job_meta_keys( $admin_only ){
	$admin_only = array( 'job_admin_only' );
	return $admin_only;
}

As you can see in the example above, I am ONLY returning the job_admin_only  meta key through the filter, specifying I only want that one to be used for logic and to be output on the frontend javascript object storage (the value of that field for the listing).

Multiple meta keys can be specified by simply adding another one in the array:

$admin_only = array( 'job_admin_only', 'job_admin_only_2' );

The values passed to the example function above $admin_only , is an array of all the admin only fields on your site.  By simply redefining that array and returning our new one, you are instructing my plugin to ONLY allow that field for use.

Specifying Default Values

You can also specify a default value you want to be used whenever a new listing is being created, or when an existing listing is being edited, that does not have a value saved to the listing, for that field.  To do this, we just create a nested array on the meta key we want to set the default value for:

$admin_only = array( 'job_admin_only' => array( 'default' => 'VALUE' ) );

This will result in any logic you have setup on that field, to use that VALUE  as default.  For example, a user is creating a new listing, and you have logic configured to show job_salary  when job_admin_only  is VALUE  … when the page loads, the job_salary  field will be showing, because you have set VALUE as a default value for that field.  If you then edit that listing as an administrator in the admin backend and change that value to something else … when the frontend user goes to edit the listing again, they will no longer see the job_salary  field.

Here’s a full example with all the features described above:

add_filter( 'field_editor_conditional_logic_enable_admin_logic_fields', '__return_true' );
add_filter( 'field_editor_conditional_logic_custom_value_job_admin_fields', 'smyles_logic_admin_only_job_meta_keys' );

function smyles_logic_admin_only_job_meta_keys( $admin_only ){

	$admin_only = array(
		'job_admin_only' => array(
			'default' => 'yes'
		),
		'job_admin_only_2' => array(
			'default' => 'no'
		),
	);

	return $admin_only;
}

 

]]>
Field Editor Conditional Shortcodes https://plugins.smyl.es/docs-kb/field-editor-conditional-shortcodes/ Sat, 24 Mar 2018 22:13:00 +0000 https://plugins.smyl.es/?post_type=bwl_kb&p=151912 As of version 1.8.1+ the shortcodes now have conditional logic integrated with them.  Make sure to read all the documentation below, especially if you plan on nesting conditional shortcodes inside each other.

Documentation for Conditional Shortcodes in version 1.7.0 through 1.8.0, can be found here:
https://plugins.smyl.es/docs-kb/field-editor-conditional-shortcodes-1-7-0-1-8-0/

Full shortcode attributes and reference can be found here:
https://plugins.smyl.es/docs-kb/shortcodes/

Conditional Shortcodes

These are the 3 new shortcodes included with version 1.8.1 of the Field Editor addon:

if_custom_field  if_job_field  if_resume_field


Conditional Shortcodes Attributes

  • equals  – value to check against value on listing
    single value fields – checks if the the value from the listing, matches exactly the value that was passed
    multiple value fields/taxonomies – checks if the ONLY value selected equals the value passed.  In regards to multiple value fields, think of this as “ONLY equals
  • contains  – value to check for anywhere in the value on the listing
    single value fields – checks if anywhere in the value on the listing, the value passed exists
    multiple value fields/taxonomies – checks if ANY of the values match the value passed (this will be most common one used for taxonomies)

Both attributes/arguments are optional, and if neither are passed, any value (other than an empty one) on the listing will result in the check returning true

What are conditionals?

Conditionals allow you to specify when you want some custom content to be output, based on the value of a field on a listing.  The best way to explain this, is with examples, so let’s dive right into it.  Here’s a basic example of using the conditional shortcodes:

[if_custom_field key="job_salary"]
    This listings salary is [job_field key="job_salary"] annually.
[/custom_field]

As you can see above, we are using one of the new conditional shortcodes [if_custom_field key=”job_salary”]  , along with a closing shortcode ([/if_custom_field] ) which allows you to specify custom content (or other shortcodes), before the closing shortcode, which will only be output, if that field has a value.

In the example above, if job_salary  had a value of $40,000, this would be the output on the listing:

The listing salary is $40,000 annually.

Conditional [else]

In additional to the standard conditional shortcode, you can also nest an [else]  shortcode inside of the shortcode content, to specify content to output if the field does not have a value.  Using the example above, let’s add an [else] shortcode to it:

[if_custom_field key="job_salary"]
    This listings salary is [job_field key="job_salary"] annually.
[else]
    This listing does not provide a salary.
[/if_custom_field]

In the example above, we have added an [else] shortcode, which will output any content (and/or shortcodes) below the [else] shortcode, and above the closing shortcode [/custom_field] , when the field does not have a value (or the original logic evaluates to false.  See below for more details).

Conditional Value Checking

You can also fine tune the shortcodes even more, using conditional value checking.  Conditional value checking allows you to check for specific values using the arguments found above.

[if_custom_field key="job_start_time" contains="AM"]
    This is an early morning position, that starts at [job_field key="job_start_time"]
[/if_custom_field]

This would check the value of the job_start_time field, and if it contains AM in the value, it would output whatever is inside the shortcode content (before closing bracket).  To keep the examples simple, I removed the [else]  shortcode, but that can be used anywhere in the conditional shortcodes logic.  If the value of that field does not contain AM (exactly as you entered it), nothing will be output.

Array/Multiple/Taxonomy Value Fields

These type of fields would be something like, multiselect fields (including taxonomies), or multiple file upload fields.  If the field type can save multiple values you should make sure to choose the right value checking argument. Example using job_category when set to allow multiple categories:

[if_custom_field key="job_category" contains="Restaurant"]
    This is a Restaurant listing because the Restaurant category was ONE of the selected categories!
[/if_custom_field]

If the user selected Restaurant AND Cafe under categories, the above will output specifically because Restaurant was selected .. even if other categories were selected as well!

Using the equals shortcode on multiple value field types will ONLY result in being true (outputting value above [else]), if there is only one value and that value matches the passed value.  You can think of using equals with multiple value field types as meaning “ONLY equals“.

As example, if we instead used equals instead of contains like above:

[if_custom_field key="job_category" equals="Restaurant"]
    This is a Restaurant listing because the Restaurant category was ONE of the selected categories!
[/if_custom_field]

Nothing would output from the above shortcode … why?  Because both Restaurant AND Cafe were selected, and since you used equals .. technically it does not only equal Restaurant

Negating Shortcodes Conditions

You can also negate conditional value checking, by adding the NOT attribute (without a value) inside the opening shortcode.  This basically will do the opposite of whatever value checking attribute you decide to use.  So using our example above, if I wanted to output something (without using an [else] statement), when job_start_time does NOT contain “AM”:

[if_custom_field key="job_start_time" NOT contains="AM"]
    This IS NOT an early morning position, it starts at [job_field key="job_start_time"]
[/if_custom_field]

Using a negated shortcode condition would be used in situations where you don’t want to output anything when it equates to true, but do want to output something with it does NOT equate to true.  This would be exactly the same as doing this:

[if_custom_field key="job_start_time" contains="AM"]
[else]
    This is an early morning position, that starts at [job_field key="job_start_time"]
[/if_custom_field]

Case Sensitive Values

There may be situations where you are unsure if the user entered AM or am (uppercase or lowercase, or anything in between), and by default the values you enter ARE NOT CASE SENSITIVE … if you want them to be case sensitive, you can also pass the case_sensitive attribute with a value of true and it will check values, only matching if the value is exactly the same (case wise):

[if_custom_field key="yes_field" equals="YES" case_sensitive="true"]
    This will only be output when the value equals YES exactly! If the value were Yes, yes, yEs, yeS, etc you would not see this.
[/if_custom_field]

Nesting Caveats

If you want to use shortcode conditionals, there is one caveat that you need to be aware of.  You can not use the same shortcode nested inside of itself. As an example, this will NOT work:

[if_custom_field key="job_hours"]
    [if_custom_field key="job_salary"]
        This listings salary is [job_field key="job_salary"] annually.
    [/if_custom_field]
[/if_custom_field]

The reason the above code WILL NOT WORK CORRECTLY  … as you can assume, WordPress has no way to know which opening shortcode is supposed to go with the closing one.

Workaround

The workaround for the caveat above, is to use multiple conditional shortcodes as required (even if it’s not a job or resume).  That’s the reason for having the extra if_job_field and if_resume_field … all three of the if shortcodes do exactly the same thing, and call the same exact function, but because they are different, WordPress can parse the shortcodes when they are nested, so for instance, this would work:

[if_custom_field key="job_hours"]
    [if_job_field key="job_salary"]
        This listings salary is [job_field key="job_salary"] annually.
    [/if_job_field]
[/if_custom_field]

You can still use all the other standard shortcodes inside of the conditional shortcodes, the only issue is with using the SAME conditional shortcode, nested inside of itself.  Voila!

]]>
Customize taxonomy output order sorting by name https://plugins.smyl.es/docs-kb/customize-taxonomy-output-order-sorting-by-name/ Mon, 21 Nov 2016 00:17:51 +0000 https://plugins.smyl.es/?post_type=bwl_kb&p=120536 As of WP Job Manager Field Editor version 1.6.3+ you can now use a filter to customize the order in which taxonomy values are output when using any of the available output methods.  Below I will go over how the filter works, as well as provide an example to do so.

If you are not comfortable with adding filters/functions to your child theme’s functions.php  file, I recommend installing the Code Snippets plugin and using that to add your custom code (I still use this a lot of the time myself).

Features

  • Sorting is based on taxonomy Name and is case-insensitive (capitalization does not matter)
  • Any values not included in the sort array will be added after the sorted values
If you want to sort the values that are displayed in form fields (on submit or search page), you can use any WordPress taxonomy sorting plugin to do this and my plugins will automatically use that order.  This documentation is specifically for the OUTPUT of taxonomy values on a listing.

Example Filter

The filter you would use to specify the custom sorting is based on the taxonomy you’re going to sort.  If you don’t know the taxonomy slug, goto the screen where you can edit/add taxonomy values, and look at the URL in your browser, it is the value right after taxonomy= , as an example if this was my URL:

https://domain.com/wp-admin/edit-tags.php?taxonomy=food_styles&post_type=job_listing

The taxonomy slug would be food_styles

Using the example taxonomy above, the filter you would use, is as follows:

add_filter( 'field_editor_food_styles_tax_output_sort', 'custom_food_styles_sorting', 10, 4 );

As you can tell, the filter syntax would be:

field_editor_TAXONOMYSLUG_tax_output_sort

Example Function

In the example above, the function used for the filter is going to be custom_food_styles_sorting, with a priority of 10, and 4 args that will be passed to that function.

The 4 args that are passed to the function is as follows (you will probably not need all of them, but they are provided for reference or advanced developer usage):

$sort  – first argument passed is an empty array array() , if you return an empty array nothing will be sorted

$meta_key  – second argument is the meta key that is associated with this taxonomy and was called to be output

$listing_id – third argument is the listing ID that is being output

$args  – fourth argument is an array of field configuration data

function custom_food_styles_sorting( $sort, $meta_key, $listing_id, $args ){

    $my_sort = array( 'breakfast', 'Lunch', 'Dinner' );
    return $my_sort;

}

As you can see in the example above, in the function I have defined that I want the taxonomy output sorted in the order of  ‘breakfast’, ‘Lunch’, ‘Dinner’

You will notice that I did not capitalize the first value breakfast , and that was on purpose to show you below, how sorting is done case-insensitive, to still sort correctly, even if there was a user input error (you did not capitalize correctly), or if capitalization is changed on the taxonomy itself, but not in the code for sorting.

Full Code Example

add_filter( 'field_editor_food_styles_tax_output_sort', 'custom_food_styles_sorting', 10, 4 );

function custom_food_styles_sorting( $sort, $meta_key, $listing_id, $args ){

    $my_sort = array( 'breakfast', 'Lunch', 'Dinner' );
    return $my_sort;

}

Full Example Output:

Let’s say that on our example listing, the person who submitted the listing selected these taxonomy values:

Breakfast, Brunch, Lunch, Dinner

Normally without any custom sorting (without using the filter), the default output would be in alphabetical order, and would look like this:

Breakfast, Brunch, Dinner, Lunch

Notice how Lunch  is showing after Dinner … which is not what we want, so to fix it, we add the example code from above to our site.

When we add our custom sorting code above to our child theme’s functions.php  file (or using Code Snippets plugin), the order we defined was:

$my_sort = array( 'breakfast', 'Lunch', 'Dinner' );

The values output on the listing would then look like this:

Breakfast, Lunch, Dinner, Brunch

You will notice that the first value, Breakfast, the output is capitalized, but in our sort array we did not capitalize it.  That is because the values you pass to the sorting filter are case-insensitive, the actual value (with capitalization) that will be output, is based on how you have it set in the taxonomy configuration (in WordPress admin area).

You may also notice that Brunch  is now showing on the end.  This is because you did not define Brunch  in your sort array, and as such, it is added to the end of the sorted values when output.  To include Brunch  in the sorting, all you need to do is add Brunch  to the array $my_sort = array( ‘breakfast’, ‘Brunch’, ‘Lunch’, ‘Dinner’ ); and then it will be included in the sorting and output like this:

Breakfast, Brunch, Lunch, Dinner

And voila! Profit!

]]>
Using the integrated Widget https://plugins.smyl.es/docs-kb/using-the-integrated-widget/ Thu, 29 Jan 2015 01:56:12 +0000 https://plugins.smyl.es/?post_type=bwl_kb&p=39481 WP Job Manager Field Editor comes with an integrated Widget you can use to customize the location of output in your theme wherever widgets are supported.

You will find the widget under the standard widgets with the title Custom Field.  All you need to do is select the widget and drag and drop it in the widget area you would like the field to display at.  You can only output one field per widget, if you want to have multiple fields output you will need to add multiple widgets.

Widget options are exactly the same as the Auto Output including Output As and other options/configurations.

Once you drag over the widget you will see the options available for configuration, which as of version 1.2.4, includes the following:

WP Job Manager Field Editor Widget

WP Job Manager Field Editor Widget

Title

This field is the title used by the standard WordPress widget.

Use Widget Style

WordPress by default has a widget style which is normally set by the theme you’re using.  If you have a Title set and the Use Widget Style checkbox is enabled this will more than likely display the widget title on the page (all depends on the theme).  Leaving this unchecked will remove any widget style’s applied to the widget by your theme.

Show Label

This setting will output the label configured for the field before the actual field value/output.

Field Meta Key

This is the meta key configured in the field settings that you wish to output.  I do not recommend selecting the default fields as these are already automatically output by the templates and have not been tested to fully function correctly.  The only reason I left the default fields in the dropdown was per request of a few users.

Extra Classes

Any extra classes you want to add to the DIV that is output for any custom configuration

Output As

This is a dropdown of available output options.  Most of the time the standard value output is all you will need.

]]>