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
@iamrealfarhanbd
iamrealfarhanbd / fluentform-flatpickr-range.js
Last active May 25, 2023 08:47
This code snippet demonstrates how to use the Flatpickr library with jQuery to create a range datepicker and dynamically display the selected date range as a message in a <p> element.
{
mode: "range",
onClose: function(selectedDates, dateStr, instance) {
if (selectedDates.length === 2) {
// Get the start and end dates
var startDate = selectedDates[0];
var endDate = selectedDates[1];
// Calculate the number of nights
var nightCount = Math.round(
@iamrealfarhanbd
iamrealfarhanbd / fluentform-submissions-widgets-hooks.php
Created May 23, 2023 09:02
Adds PDF download buttons to FluentForm submissions widgets.
add_filter('fluentform/submissions_widgets', array($this, 'pushPdfButtons'), 10, 3);
public function pushPdfButtons($widgets, $data, $submission)
{
$formId = $submission->form->id;
$feeds = $this->getFeeds($formId);
if (!$feeds) {
return $widgets;
}
$widgetData = [
@iamrealfarhanbd
iamrealfarhanbd / Ninja Tables No result found.js
Created May 15, 2023 05:11
Ninja Tables No Result found Changing by custom js code
$table.on('after.ft.sorting after.ft.filtering', function() {
// Code to run when "No Result Found" message appears
$('.footable-empty td').html('<a href="your-registration-page-url" target="_blank">Click here to register</a>');
});
@iamrealfarhanbd
iamrealfarhanbd / Ninja-tables-column-sum.js
Last active September 5, 2023 04:44
The "Ninja Tables" JavaScript Function for Calculating Column Sums in a Table
// Math summation on columns
var myClasses= "column_one, column_two, column_three"; //give your columns key, you can use multiple by using comma
var totalText = "Total: "; // you can change the 'Total' text here
// Ensure that the rendering code only runs once
var hasRendered = false;
if(!$table.find('tfoot').length){
jQuery("<tfoot></tfoot>").appendTo($table);
@iamrealfarhanbd
iamrealfarhanbd / Ninja_Tables_Row_&_Column_freeze.css
Last active May 16, 2024 05:41
Ninja Tables Row & Column freeze
/*
:::::::::::::::::::
:: Column freeze ::
:::::::::::::::::::
*/
#footable_parent_NT_ID tbody tr td:nth-child(1), #footable_parent_NT_ID thead th:nth-child(1){
position: sticky;
position: -webkit-sticky;
left: 0;
z-index: 1;
@iamrealfarhanbd
iamrealfarhanbd / Fluent_Form_regex_time_range.js
Last active February 25, 2023 11:09
Fluent Form regex match time range 11:30pm to 6:30AM
^(((11)(:[3-5][\d])? ?[pP]\.?)|((12|[1-6])(:[0-3][\d])? ?[aA]\.?))[mM]\.?$
add_filter('ninja_table_search_time_delay', function ($tableId) {
return -1;
});
@iamrealfarhanbd
iamrealfarhanbd / How to get Parameter value
Last active January 12, 2023 04:51
How to get Parameter value and insert that value inside the Ninja tables input -frontend editing; Video: https://watch.screencastify.com/v/1Scl8kg11IJhrb1ZbNtk
jQuery( document ).ready(function() {
jQuery(".footable-add").click(function(){
const urlParams = new URLSearchParams(window.location.search);
const firstField = urlParams.get('custom');// your value from url
const secondField = urlParams.get('custom2');// your value from url
const firstInput = jQuery('.nt_input_YourColumnKey')// target your input field
const secondInput = jQuery('.nt_input_YourColumnKey')// target your input field
firstInput.attr("value", firstField);//insert your params value in input
secondInput.attr("value", secondField);//insert your params value in input
@iamrealfarhanbd
iamrealfarhanbd / Hide_Ninja_Table_Column_until_Search_any_data.css
Created November 28, 2022 06:16
Hide Ninja Table Column until Search or filter any data
#footable_parent_NT_ID table:not(.ninja_has_filter) tbody, #footable_parent_NT_ID table:not(.ninja_has_filter) tfoot, #footable_parent_NT_ID table:not(.ninja_has_filter) .footable-header {
display: none !important;
}
@iamrealfarhanbd
iamrealfarhanbd / add_to_cart_button_without_relaod_page.js
Last active November 8, 2022 06:19
How to add to cart button in Woocommerce work without reloading the page add the product to cart jquery
$(document).on('click', '.ninja_clmn_nm_add_to_cart a', function(e) {// provide your button class or target your button here
var $thisbutton = $(this);
try {
var href = $thisbutton.prop('href').split('?')[1];
if (href.indexOf('add-to-cart') === -1) return;
} catch (err) {
return;
}
e.preventDefault();