Skip to content

Instantly share code, notes, and snippets.

View iamrealfarhanbd's full-sized avatar
💻
always do code

Farhan Ahmed iamrealfarhanbd

💻
always do code
View GitHub Profile
#Exclude Files From Defer Js
You can follow the documentation from WP Rocket here - https://docs.wp-rocket.me/article/976-exclude-files-from-defer-js
##The FluentForms JS files are located in these two paths:
wp-content/plugins/fluentform/public/js
wp-content/plugins/fluentformpro/public/js
You can exclude them one by one or full JS folder.
// output = iamfarhan09@gmail.com = true;
// output = iamfarhan09@gmail = false
// output = iamfarhan09@gmail.com.co =true
//N.B: you have to replace all ids with your form id otherwise it will not work.
jQuery(document).ready(function() {
jQuery("#fluentform_36 button[type='submit']").attr('disabled', true);
jQuery('input#ff_36_email').on("change", function() {
add_action('fluentform_before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 17) { // 17 is your form id. Change the 17 with your own login for ID
return;
}
$redirectUrl = home_url(); // You can change the redirect url after successful login
if (get_current_user_id()) { // user already registered
wp_send_json_success([
'result' => [
// there are two way generate a link to logout
1. <a href="https://Yourdomain/wp-login.php?loggedout=true">Logout</a>
2. <a href="http://example.com/wp-login.php?action=logout">Logout</a>
@iamrealfarhanbd
iamrealfarhanbd / Simple Image Slider with Button
Created April 30, 2022 09:34
Learn how to create a modal image gallery (lightbox) with CSS and JavaScript:-This is a a slideshow of images where if you click a button then the button will popup the one image then after press next button the image will start slide
<style>
.row > .column {
padding: 0 8px;
}
.row:after {
content: "";
display: table;
clear: both;
}
.column {
// Math summation on columns
var myClasses= "onecolumn, twocolumn, threecolumn"; //give your columns key, you can use multiple by using comma
var totalText = "Total: "; // you can change the 'Total' text here
var totalRecord = ` from ${tableConfig.init_config.rows.responseJSON.length} records` ; //Total Records Here
if(!$table.find('tfoot').length){
jQuery("<tfoot></tfoot>").appendTo($table);
}
var myClasses= "index"; // column key
var notThis = [];
var singleClass = "ninja_clmn_nm_"+myClasses.trim();
jQuery('tbody tr').find(' .'+singleClass+'').each (function (index) {
notThis.push(index);
$table.find('tbody' + ' .ninja_table_row_'+index +' .'+singleClass+'').append(`<span>${index+1}</span>`);
});
function checkIfElse() {
const orangeimageUrl = "https://girkinger-immobilien.at/wp-content/uploads/2022/06/Formular_Pfeil_rechts_orange-84x84px.png"; /* Hier URL des orangen Pfeils einfügen */
const nextimageUrl = "https://girkinger-immobilien.at/wp-content/uploads/2022/05/Formular_Pfeil_rechts_blau-84x84px.png"; /* Hier URL des blauen Pfeils einfügen */
if(jQuery('input[type="radio"]').is(':checked') || jQuery('input[type="range"]').is(':visible') ){
jQuery("button.ff-float-right.ff-btn.ff-btn-next.ff-btn-secondary").css("background-image", "url(" + orangeimageUrl + ")");
}else{
jQuery("button.ff-float-right.ff-btn.ff-btn-next.ff-btn-secondary").css("background-image", "url(" + nextimageUrl + ")");
}
}
add_filter('fluent_file_uploaded', function($uploadFile, $formData, $form) {
$url = $uploadFile['url'];
$uploadDir = str_replace('/', '\/', FLUENTFORM_UPLOAD_DIR.'/temp' );
$pattern = "/(?<=${uploadDir}\/).*$/";
preg_match($pattern, $url, $match);
if (!empty($match)) {
$file = str_replace($match[0], \FluentForm\App\Helpers\Protector::decrypt($match[0]), $url);
}
return $file ;
},10,3);