Instantly share code, notes, and snippets.

View functions.php
<?php
/**
* Add iFrame to allowed wp_kses_post tags
*
* @param string $tags Allowed tags, attributes, and/or entities.
* @param string $context Context to judge allowed tags by. Allowed values are 'post',
*
* @return mixed
*/
function smyles_custom_wpkses_post_tags( $tags, $context ) {
View functions.php
<?php
$smyles_enable_slow_geo = true;
function smyles_add_30_min_cron_schedule( $schedules ) {
$schedules['every_thirty_minutes'] = array(
'interval' => 1800,
'display' => __( 'Every 30 Minutes' )
);
View functions.php
<?php
// Must be higher than priority 20 (when core WPJM runs save)
add_action( 'job_manager_save_job_listing', 'smyles_no_sanitize_value_admin_handler', 30, 2 );
function smyles_no_sanitize_value_admin_handler( $post_id, $post ) {
// Set this value to the actual meta key
$key = 'some_meta_key';
// DO NOT edit below this line
View functions.php
<?php
add_filter( 'oembed_dataparse', 'smyles_soundcloud_oembed_show_small_player', 10, 3 );
function smyles_soundcloud_oembed_show_small_player( $html, $data, $url ) {
// Only process for soundcloud oembeds
if ( strpos( $url, 'soundcloud.com' ) === false ) {
return $html;
}
View functions.php
<?php
// Example below if for meta key of "listing_soundcloud", replace "listing_soundcloud" with the meta key of field you are using
add_filter( 'field_editor_output_as_value_listing_soundcloud', 'smyles_add_color_to_soundcloud_url' );
function smyles_add_color_to_soundcloud_url( $value ) {
// If empty value, or does not have soundcloud.com in value, return value without adding color
if( empty( $value ) || strpos( $value, 'soundcloud.com' ) === FALSE ){
return $value;
View functions.php
<?php
add_filter( 'job_manager_get_posted_textarea_field', function(){
return 'smyles_no_sanitize_textarea_metakey_handler';
});
function smyles_no_sanitize_textarea_metakey_handler( $key, $field ){
$dirty = isset( $_POST[ $key ] ) ? trim( $_POST[ $key ] ) : '';
$clean = isset( $_POST[ $key ] ) ? wp_kses_post( trim( stripslashes( $_POST[ $key ] ) ) ) : '';
View functions.php
<?php
// You MUST replace "META_KEY" below with the meta key you want to apply the_content filter to before it's output
// This is useful for things like auto embedding, auto paragraphs, etc
add_filter( 'field_editor_output_as_value_META_KEY', 'smyles_apply_the_content_filter' );
function smyles_apply_the_content_filter( $value ){
if( empty( $value ) ) return $value;
return apply_filters( 'the_content', $value );
View functions.php
<?php
// This example below will add the "my_shortcode" shortcode for usage in all email templates
// You MUST make sure that you use a unique shortcode that does not match ANY of the meta keys of fields!!
// Passed arguments are same as when adding a shortcode like normal (using add_shortcode)
// Called from wp-content/plugins/wp-job-manager-emails/includes/class-shortcodes.php around line #648
add_filter( 'job_manager_emails_default_core_shortcodes', 'smyles_add_custom_default_shortcode_wpjm_emails', 9999 );
View functions.php
<?php
add_filter( 'job_manager_job_listing_data_fields', 'smyles_change_featured_listing_label', 9999 );
function smyles_change_featured_listing_label( $fields ){
if( array_key_exists( '_featured', $fields ) ){
$fields['_featured']['label'] = __( 'Make Listing Sticky' );
$fields['_featured']['description'] = __( 'Featured listings will be sticky during searches, and can be styled differently.' );
}
View custom.css
/* Listable for some weird reason hides the company_logo field which is what is used for setting the featured image */
/* Add the CSS below to the custom CSS section in the Customizer to force Listable theme to show the company_logo field */
fieldset.fieldset-company_logo {
display: inherit;
}