Archives: Snippets
WPForms: add field description in notification HTML and plain text emails
// HTML Email. add_filter( ‘wpforms_html_field_value’, static function ( $field_val, $field, $form_data, $context ) { if ( $context !== ’email-html’ ) { return $field_val; } if ( empty( $form_data[‘fields’][ $field[‘id’] ] ) ) { return $field_val; } $field_data = $form_data[‘fields’][ $field[‘id’]…Continue reading
WPForms: new smart tag – Current Unix Time
// Register the smart tag. add_filter( ‘wpforms_smart_tags’, static function( $tags ) { // Key is the tag, value is the tag name. $tags[‘current_unix_time’] = ‘Current Unix Time’; return $tags; } ); // Replace its value on form render on front-end.…Continue reading
WPForms: new smart tag – Current Date/Time
// Register the smart tag. add_filter( ‘wpforms_smart_tags’, static function( $tags ) { // Key is the tag, value is the tag name. $tags[‘current_time’] = ‘Current Date/Time’; return $tags; } ); // Replace its value on form render on front-end. add_filter(…Continue reading
WPForms: hide certain sections on a single entry page: notes, log, debug, meta, payment, actions, related, geolocation.
// Main content area. add_action( ‘wpforms_entry_details_content’, static function ( $entry, $form_data, $single_entry ) { $hook_name = ‘wpforms_entry_details_content’; remove_action( $hook_name, [ $single_entry, ‘details_fields’ ], 10 ); remove_action( $hook_name, [ $single_entry, ‘details_notes’ ], 10 ); remove_action( $hook_name, [ $single_entry, ‘details_log’ ], 40…Continue reading
WPForms: display a form under the confirmation message with or without user entered field values.
add_action( ‘wpforms_frontend_output_success’, static function ( $form_data, $fields, $entry_id ) { unset( $_GET[‘wpforms_return’], $_POST[‘wpforms’][‘id’] ); // If you want to preserve the user entered values in form fields – remove the line below. unset( $_POST[‘wpforms’][‘fields’] ); // Actually render the form.…Continue reading
Custom Countries
function pw_edd_custom_countries( $countries = array() ) { $countries = array( ‘US’ => ‘United States’, ‘CA’ => ‘Canada’ ); return $countries; } add_filter( ‘edd_countries’, ‘pw_edd_custom_countries’ );Continue reading
Facebook storage tracking
Blog filter
Szállítási módok elrejtése a Kosár oldalon
add_filter( ‘woocommerce_cart_ready_to_calc_shipping’, function( $show_shipping ) { if ( is_cart() ) { return false; } return $show_shipping; }, 99 );Continue reading