Skip to content

Instantly share code, notes, and snippets.

@slaFFik
Last active January 1, 2021 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaFFik/428366f13fedb97d3e5d6eaf29709018 to your computer and use it in GitHub Desktop.
Save slaFFik/428366f13fedb97d3e5d6eaf29709018 to your computer and use it in GitHub Desktop.
WPForms: Change the JS validation strings based on a form ID (useful for multi-language sites)
<?php
add_filter( 'wpforms_frontend_strings', function( $strings ) {
global $post;
if ( ! isset( $post->post_content ) ) {
return $strings;
}
preg_match( '~\[wpforms id=\"(\d+)\"~', $post->post_content, $matches );
if ( ! is_array( $matches ) || ! isset( $matches[1] ) ) {
return $strings;
}
$form_id = (int) $matches[1];
// This form ID should be changed and the text below it as well.
if ( 181 === $form_id ) {
$strings['val_required'] = 'PUT HERE YOUR CUSTOM TEXT';
}
return $strings;
} );
@abdelilahsadki12
Copy link

hello sir
How we can download file based on value selected inn dropdown in wordpress

once you fill details you can download the file. now I want to change. now there is dropdown in contact form. depending upon the value selected in the dropdown, the related file should download

ex. dropdown having values: value1 and value2 and files are file1 and file2

whenever user select value1 in contact form then file1 should download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment