This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //adding nonce in extra js inline script | |
| add_filter('script_loader_tag', function ($tag, $handle) { | |
| if ('script-handler' === $handle) { | |
| $nonce = wp_create_nonce(); | |
| $tag = str_replace('<script ', "<script nonce='$nonce' ", $tag); | |
| } | |
| return $tag; | |
| }, 10, 2); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Share a public live url of you local site | |
| // First setup ngork you will need an account | |
| //add these to wp-config.php | |
| $_SERVER['HTTPS'] = 'on'; | |
| define('WP_SITEURL', 'https://' . $_SERVER['HTTP_X_ORIGINAL_HOST']); | |
| define('WP_HOME', 'https://' . $_SERVER['HTTP_X_ORIGINAL_HOST']); | |
| $_SERVER['HTTP_HOST'] = $_SERVER["HTTP_X_ORIGINAL_HOST"]; // Valet share hack | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //turn off form style | |
| add_action( 'wp_enqueue_scripts', function () { | |
| wp_deregister_style( 'fluentform-public-default' ); | |
| }, 99 ); | |
| //turn off button style | |
| add_filter('fluentform_submit_button_force_no_style','__return_true'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Input Default Values form url array values | |
| * {thrivecart.customer.email} | |
| */ | |
| add_filter('fluentform_editor_shortcode_callback_group_thrivecart', function ($handler, $form, $handlerArray) { | |
| $handler = \FluentForm\App\Services\FormBuilder\EditorShortcodeParser::parseValue($handler); | |
| $handlerKey = array_pop($handler); | |
| if (!$handlerKey) { | |
| return ''; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('fluentform_quiz_score_value', function ($result, $formId, $scoreType, $quizResults){ | |
| $targetId = 154; // change your form ID | |
| if($formId != $targetId){ | |
| return $result; | |
| } | |
| if($scoreType == 'percent'){ | |
| $score = 0; | |
| $totalPoints = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //paste this in the custom JS section of fluentform | |
| $form.on('submit',function(){ | |
| var text = 'Hello Alex'; | |
| var phone = '8801715928113'; | |
| window.open(`http://api.whatsapp.com/send?phone=${phone}&text=${text}`, '_blank'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('fluentform_user_registration_feed',function($feed, $entry, $form){ | |
| if($form->id != 1){ | |
| return; | |
| } | |
| //get role value | |
| $response = json_decode($entry->response,true); | |
| $roleInputName = 'input_radio'; | |
| $role = $response[$roleInputName]; | |
| //set role | |
| $feed['processedValues']['userRole'] = $role; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('fluentform_rendering_field_data_input_checkbox', function ($data, $form) { | |
| { | |
| //change form ID | |
| if ($form->id != 5) { | |
| return $data; | |
| } | |
| //set get param value & match with checkbox value | |
| if (isset($_GET['my_value'])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('fluentform_validate_input_item_repeater_field', function ($errorMessage, $field, $formData, $fields, $form) { | |
| $name = 'repeater_field'; | |
| $data = $formData[$name]; | |
| $col_index = 0; | |
| $values= array_column($data,$col_index); | |
| $unique_count = count(array_unique($values)); | |
| $count = count($values); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add this function to function.php and change target form ID | |
| add_filter('fluentform_rendering_form', function ($form) { | |
| // change form ID | |
| $targetFormId = 108; | |
| if ($form->id != $targetFormId) { | |
| return $form; |