Get value from a post ID

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_show_post_shortcode’, 10, 4); function frm_show_post_shortcode($replace_with, $tag, $atts, $field){ if(isset($atts[‘show_post’]) and is_numeric($replace_with)){ $post = get_post($replace_with); if($post){ if(isset($post->{$atts[‘show_post’]})) $replace_with = $post->{$atts[‘show_post’]}; else $replace_with = get_post_meta($post->ID, $atts[‘show_post’], true); } } return $replace_with; }Continue reading

Link to posts with Data from Entries field

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_dfe_link_to_post’, 10, 4); function frm_dfe_link_to_post($replace_with, $tag, $atts, $field){ if ( isset($atts[‘link’]) && $atts[‘link’] == ‘true’ && isset( $atts[‘show’] ) && $atts[‘show’] == ‘id’ ){ if ( !is_array( $replace_with ) ){ $replace_with = array( $replace_with ); } $ids = array_filter(…Continue reading

Add a case-sensitive like comparison

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_check_for_case_sensitive_like_value’, 20, 4); function frm_check_for_case_sensitive_like_value( $replace_with, $tag, $atts, $field ){ if ( isset( $atts[‘case_sensitive_like’] ) && ! empty( $replace_with ) ) { if ( is_array( $replace_with ) ) { if ( ! in_array( $atts[‘case_sensitive_like’], $replace_with ) ) { $replace_with…Continue reading

Use Base64 file info

add_filter( ‘frmpro_fields_replace_shortcodes’, ‘frm_get_file_info’, 10, 4 ); function frm_get_file_info( $replace_with, $tag, $atts, $field ) { if ( ! is_numeric( $replace_with ) ) { return $replace_with; } $use_base64 = isset( $atts[‘encoding’] ) && $atts[‘encoding’] === ‘base64’; $use_path_info = ! $use_base64 && isset(…Continue reading

Show last four characters

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_substr_shortcode’, 10, 4); function frm_substr_shortcode($replace_with, $tag, $atts, $field){ if(isset($atts[‘substr’])){ $replace_with = substr($replace_with, $atts[‘substr’]); } return $replace_with; }Continue reading

Show an avatar from email

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_substr_shortcode’, 10, 4); function frm_substr_shortcode($replace_with, $tag, $atts, $field){ if(isset($atts[‘avatar’])){ $replace_with = get_avatar($replace_with, $atts[‘avatar’]); } return $replace_with; }Continue reading

Insert multiple values into a shortcode

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_make_shortcode’, 10, 4); function frm_make_shortcode($replace_with, $tag, $atts, $field){ if(isset($atts[‘shortcode’])){ $new_val = ”; foreach((array)$replace_with as $v){ if(is_numeric($v)) $new_val .= ‘[jwplayer file=”‘. wp_get_attachment_url($v) .’”]’; } return $new_val; } return $replace_with; }Continue reading

Link thumbnail to full size images with multiple uploads

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_make_shortcode’, 10, 4); function frm_make_shortcode($replace_with, $tag, $atts, $field){ if(isset($atts[‘link_full’])){ $new_val = ”; foreach((array)$replace_with as $v){ if(is_numeric($v)){ $full = wp_get_attachment_image_src($v, ‘full’); $thumb = wp_get_attachment_image_src($v); $new_val .= ‘<a href=”‘. $full[0] .’”><img src=”‘ . $thumb[0] . ‘” /></a>’; } } return $new_val;…Continue reading

Only show first file from a multiple-image upload

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_show_first’, 10, 4); function frm_show_first($replace_with, $tag, $atts, $field){ if(isset($atts[‘show_first’])){ extract( shortcode_atts(array( ‘show_first’ => ‘0’, ), $atts ) ); $replace_with = array_filter((array)$replace_with); $new_val = array_slice($replace_with, 0, $show_first); return $new_val; } return $replace_with; }Continue reading

Insert a link for each field option into a shortcode

add_filter(‘frmpro_fields_replace_shortcodes’, ‘frm_make_shortcode’, 10, 4); function frm_make_shortcode($replace_with, $tag, $atts, $field){ if(isset($atts[‘shortcode’])){ $new_val = ”; foreach((array)$replace_with as $v){ $new_val .= ‘<a href=”testing.com/?paramname=’.$v.’”>’ . $v . ‘</a>, ‘; //modify testing.com and paramname to whatever you would like. } return $new_val; } return $replace_with;…Continue reading