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 / Formatting_Number_in_Ninja_Tables.js
Last active October 6, 2023 05:09
jQuery Code for Formatting Numbers in a Table Column
// you can replace "_amount" with you column key column_key
$('tbody .ninja_clmn_nm_amount').each(function() {
// Get the cell value and parse it as an integer
var cellValue = parseInt($(this).text().trim());
// Check if the value is 1000 or more
if (cellValue >= 1000) {
// If it's 1000 or more, format the value with commas
$(this).text(cellValue.toLocaleString());
@iamrealfarhanbd
iamrealfarhanbd / Ninja_Tables_first_column_freeze.css
Created September 25, 2023 10:43
Custom CSS code to make the left first columns of a Ninja Table sticky when scrolling to the right.
#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;
background: #fafafb;
font-weight:bold;
}
@iamrealfarhanbd
iamrealfarhanbd / Ninja_Tables_first_two_column_freeze.css
Last active September 14, 2023 09:16
Custom CSS code to make the left two columns of a Ninja Table sticky when scrolling to the right.
#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;
background: #fafafb;
font-weight:bold;
}
#footable_parent_NT_ID tbody tr td:nth-child(2), #footable_parent_NT_ID thead th:nth-child(2){
position: sticky;
/*!
* jQuery Rowspanizer Plugin (Modified) v0.2
* https://github.com/marcosesperon/jquery.rowspanizer.js
*
* Copyright 2011, 2015 Marcos Esperón
* Released under the MIT license
*
* https://github.com/jquery-boilerplate/boilerplate/
*/
@iamrealfarhanbd
iamrealfarhanbd / Ninja_Tables_Advanced_Calculation_with_decimal_separator.js
Created August 16, 2023 07:06
This JavaScript code snippet enhances Ninja Tables by providing advanced calculation capabilities. It calculates the sum of specified columns, taking into account decimal separators in cell values. The code ensures that the total result is rendered correctly with a decimal separator if cell values have decimal places, while rendering as a regula…
const myClasses = "column_one, column_two, column_three";
const totalText = "Total: ";
if (!$table.find('tfoot').length) {
$("<tfoot></tfoot>").appendTo($table);
}
const getSum = classes => {
let sum = 0;
let index = 0;
@iamrealfarhanbd
iamrealfarhanbd / extract_ninja_tables_values.sql
Created June 10, 2023 05:03
SQL query to extract values from Ninja Tables JSON column without double quotation marks.Video: https://video.drift.com/v/abuayx9mvYW/
SELECT JSON_UNQUOTE(JSON_EXTRACT(value, '$.team_name')) AS team_name,
JSON_UNQUOTE(JSON_EXTRACT(value, '$.score')) AS score,
JSON_UNQUOTE(JSON_EXTRACT(value, '$.school')) AS school
FROM wp_ninja_table_items
WHERE table_id = Your_table_ID
@iamrealfarhanbd
iamrealfarhanbd / WordPress-Admin-Credentials-Guide.md
Last active May 30, 2023 04:53
This guide provides step-by-step instructions on how to create a new user and grant administration access in WordPress. It also explains how to securely share the admin credentials with the support team for troubleshooting or assistance purposes.

Creating an Admin User and Sharing Credentials with Support Team

To create an admin user and share the credentials with a support team, you can follow these steps:

1.Login to your WordPress admin dashboard using your own admin account.

2.Navigate to the Users section in the admin menu.

3.Click on the "Add New" button to create a new user account.

@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>');
});