Change the output for a field type

add_filter( ‘frmpro_fields_replace_shortcodes’, ‘display_field_value_with_shortcode’, 10, 4 ); function display_field_value_with_shortcode( $value, $tag, $atts, $field ) { if ( $field->type != ‘signature’ ) { return $value; } $value = ‘<div class=”my_custom_class”>’ . $value . ‘</div>’; return $value; }Continue reading

Set a date relative to the current date

add_filter( ‘frm_get_default_value’, ‘frm_set_relative_date’, 10, 2 ); function frm_set_relative_date( $new_value, $field ) { if ( $field ->id == 4615 ) { //change 4615 to the ID of the field $start = strtotime( ‘today’ );//change ‘today’ to any set or relative date…Continue reading

Copy multiple field values

add_filter(‘frm_setup_edit_fields_vars’, ‘frm_copy_multiple_field_values_before_edit’, 20, 3); function frm_copy_multiple_field_values_before_edit( $values, $field, $entry_id ) { if ( FrmAppHelper::is_admin() ) { //don’t copy the field value if the entry is edited in the admin area return $values; } $field_pairs = array( //for each pair of…Continue reading

Blackout dynamic dates

add_filter( ‘frm_date_field_options’, ‘add_blackout_dates’, 30, 2 ); function add_blackout_dates( $js_options, $extra ) { if ( $extra[‘field_id’] === ‘field_jtumj’ ) { // Replace jtumj with your field key $js_options[‘formidable_dates’][‘datesDisabled’][] = date( ‘Y-m-d’, strtotime( ‘first day of january’ ) ); } return $js_options;…Continue reading

Hide month and year selectors

add_filter( ‘frm_date_field_options’, ‘hide_month_and_year’, 30, 2 ); function hide_month_and_year( $js_options, $extra ) { if ( $extra[‘field_id’] === ‘field_jtumj’ ) { // Replace jtumj with your field key $js_options[‘options’][‘changeMonth’] = false; $js_options[‘options’][‘changeYear’] = false; } return $js_options; }Continue reading

Add calendar icon to field

add_filter( ‘frm_date_field_options’, ‘add_cal_icon’, 30, 2 ); function add_cal_icon( $js_options, $extra ) { if ( $extra[‘field_id’] === ‘field_jtumj‘ ) { // Replace jtumj with your field key $js_options[‘options’][‘showOn’] = ‘button’; $js_options[‘options’][‘buttonImage’] = ‘http://jqueryui.com/resources/demos/datepicker/images/calendar.gif’; $js_options[‘options’][‘buttonImageOnly’] = true; } return $js_options; }Continue reading

Change Order of Categories

add_filter(‘frm_get_categories’, ‘frm_order_cats’, 10, 2); function frm_order_cats($args, $field){ if($field[‘id’] == 25){ //change 25 to the ID of your field $args[‘orderby’] = ‘ID’; } return $args; }Continue reading

Save day of week

add_filter( ‘frm_validate_field_entry’, ‘frm_get_day_of_week’, 11, 3 ); function frm_get_day_of_week( $errors, $field, $value ) { if ( $field->id == 847 ) { //change 847 to the ID of the Hidden or text field which will hold the day of the week $date…Continue reading

Allow brackets in redirect URL

add_filter( ‘frm_redirect_url’, ‘partial_prepare_redirect_url’, 1 ); function partial_prepare_redirect_url( $url ) { remove_filter( ‘frm_redirect_url’, ‘FrmEntriesController::prepare_redirect_url’ ); return str_replace( array( ‘ ‘, ‘|’, ‘@’ ), array( ‘%20’, ‘%7C’, ‘%40’ ), $url ); }Continue reading

Set a custom path

add_filter(‘frm_upload_folder’, ‘frm_custom_upload’); function frm_custom_upload($folder){ $folder = ‘../../wp-content/uploads/product_images/’; return $folder; }Continue reading