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
/** | |
* Open Ninja Forms redirect URL in a new browser tab after form submission. | |
* @author Faisal Ahammad <me@faisalahammad.com> | |
*/ | |
jQuery(document).ready(function($) { | |
if (typeof nfRadio !== 'undefined') { | |
nfRadio.channel('forms').on('submit:response', function(response, textStatus, jqXHR, formId) { | |
if (response && response.data && response.data.actions && response.data.actions.redirect && response.data.actions.redirect !== '') { | |
var redirectUrl = response.data.actions.redirect; |
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
/** | |
* Ninja Forms Phone Starting Digits Blocker | |
* @author Faisal Ahammad <me@faisalahammad.com) | |
*/ | |
jQuery(document).ready(function($) { | |
// Configuration: Add numbers you want to block from starting the phone number | |
const BLOCKED_STARTING_NUMBERS = ['0', '1', '88']; | |
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
jQuery(document).ready(function($) { | |
function fixMultiSelect() { | |
$('select[multiple].ninja-forms-field:not([data-fixed])').each(function() { | |
$(this).attr('data-fixed', 'true') | |
.on('mousedown', function(e) { | |
e.preventDefault(); | |
if (e.target.tagName === 'OPTION') { | |
var $opt = $(e.target); | |
$opt.prop('selected', !$opt.prop('selected')); | |
$(this).trigger('change').trigger('input'); |
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 | |
// Customize the "Max x files are allowed" message in Ninja Forms File Uploads | |
add_filter( 'ninja_forms_uploads_js_strings', 'custom_ninja_forms_uploads_js_strings' ); | |
function custom_ninja_forms_uploads_js_strings( $strings ) { | |
// Change default message to German: "Max %n Dateien sind erlaubt" | |
$strings['file_limit'] = __( 'Max %n Dateien sind erlaubt', 'ninja-forms-uploads' ); | |
return $strings; | |
} |
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 | |
/** | |
* Fix Google reCaptcha v3 loading issue in Ninja Forms with Elementor Pro. | |
* | |
* @author Faisal Ahammad <me@faisalahammad.com> | |
*/ | |
add_filter('ninja_forms_pre_enqueue_recaptcha_v3_js', 'nfele_enqueue_recaptcha_v3_js'); | |
function nfele_enqueue_recaptcha_v3_js() |
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
/** | |
* Set default hour to 09:00 for date/time fields in Ninja Forms | |
* | |
* @author Faisal Ahammad <me@faisalahammad.com> | |
* | |
* First add the "setdefaulttime" CSS class in the Date/Time → Display → Container to make this code work. | |
*/ | |
jQuery(document).ready(function($) { | |
function checkAndSetHour() { |
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 | |
/** | |
* Gravity Forms Advanced Post Creation Auto Resave | |
* | |
* This code automatically resaves posts created by the Gravity Forms Advanced Post Creation add-on. | |
* It ensures that the post is properly saved and updated in the database. | |
* Visit https://yoursite.com/?force_cron if the code doesn’t run automatically. This URL will force the cron to run. | |
* | |
* @author Faisal Ahammad <me@faisalahammad.com> | |
*/ |
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 | |
/** | |
* Gravity Forms: Redirect to Newly Created Post After Submission | |
* | |
* @author Faisal Ahammad <me@faisalahammad.com> | |
* | |
* Replace 123 with your actual Gravity Form ID. | |
*/ | |
add_filter( 'gform_confirmation_123', 'gfapc_redirect_to_created_post', 10, 4 ); |
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
/** | |
* Rearranges label and image elements in the Select Image field | |
* @author Faisal Ahammad <me@faisalahammad.com> | |
*/ | |
jQuery(document).ready(function ($) { | |
function waitForLabels() { | |
if ($(".listimage-container label").length) { | |
$(".listimage-container label").each(function () { | |
var $this = $(this); |
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::placeholder { | |
color: #000; | |
} | |
input::-webkit-input-placeholder { | |
color: #000; | |
} | |
input::-moz-placeholder { | |
color: #000; |
NewerOlder