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 / How To Use Excel Formulas in Ninja Tables.md
Last active May 22, 2024 10:08
How To Use Excel Formulas in Ninja Tables

Documentation: Using Excel Formulas in Ninja Tables

Ninja Tables supports various Excel formulas to manipulate data directly within the table. Below is a list of supported Excel formulas along with examples of how to use them in Ninja Tables.

Supported Excel Formulas:

For a comprehensive list of supported Excel formulas, please refer to Screenshot link.

Usage Example:

Documentation: Display Entries Submitted by Current User in Ninja Tables

This guide will help you display only the entries submitted by the current logged-in user using the Ninja Tables plugin in WordPress.

Steps to Achieve Current User Entries Display

1. Add User Information to Table Column

Ensure that the table includes a column with the user's name, email, or any user unique identifier.

@iamrealfarhanbd
iamrealfarhanbd / Modify Ninja Tables Data: Apply Filter Before Limiting Results.php
Created May 22, 2024 05:20
Modify Ninja Tables Data: Apply Filter and Limit in ninja_tables_get_public_data Filter Hook
add_filter('ninja_tables_get_public_data', function ($data, $tableId) {
// Set the limit and filter name here (you can adjust these values as needed)
$limit = Your_Limit_Value;
$filter_name = 'Your_Filter_Key_Word';
// Check if the current table ID matches the targeted table ID
if ($tableId == 426) { // Replace 426 with the actual table ID
// Apply the filter first
@iamrealfarhanbd
iamrealfarhanbd / Modify Ninja Tables Data Retrieval for Full-Size Image Display.php
Created May 18, 2024 05:58
This PHP code snippet demonstrates how to use the ninja_tables_get_raw_table_data filter hook to modify data fetched from Ninja Tables. Specifically, it replaces thumbnail image URLs with their corresponding full-size image URLs in the image column of a Ninja Table with YourTableID. This customization ensures that larger images are used when dis…
add_filter('ninja_tables_get_raw_table_data', function ($data, $tableId) {
// Adjust this condition based on your target table ID
if ($tableId == YourTableID) { //Change YourTableID with your table ID
foreach ($data as &$row) {
foreach ($row as $key => $value) {
// Check if the value is an array with 'image_thumb' and 'image_full' keys
if (is_array($value) && isset($value['image_thumb']) && isset($value['image_full'])) {
// Replace the 'image_thumb' URL with the 'image_full' URL
$row[$key]['image_thumb'] = $value['image_full'];
}
@iamrealfarhanbd
iamrealfarhanbd / Enhanced Pagination with Goto Input Field for Ninja Tables.js
Last active May 9, 2024 07:13
This jQuery code snippet enhances the pagination of Ninja Tables by adding a numeric input field where users can input the page number they want to navigate to directly. The input field ensures smoother navigation through large datasets, allowing users to jump to specific pages effortlessly.
jQuery(document).ready(function() {
// Function to add goto page functionality
function addGotoPageFunctionality() {
// Check if the goto input field already exists
if ($('#gotoPage').length === 0) {
// Create the goto input field and button
var gotoInput = $('<input>', { type: 'number', id: 'gotoPage', placeholder: 'Go to page', class: 'form-control', min: "1" , max: $('.footable-page').length,style: 'width:100px;padding:17px 0!important;text-align:center;' });
var gotoButton = $('<button>', { id: 'gotoButton', class: 'btn btn-default', text: 'Go' });
var gotoElement = $('<li>', { class: 'nt_goto_pager', 'aria-label': 'goto page', style: 'display:inline-flex!important;align-items:center;' }).append(gotoInput, gotoButton);
@iamrealfarhanbd
iamrealfarhanbd / Fluent Forms jQuery Function to Remove Dash from Progress Bar Step Indicators.js
Created May 3, 2024 05:13
Fluent Forms: jQuery Function to Remove Dash from Progress Bar Step Indicators
// Hide the dash initially when the document is ready
jQuery(document).ready(function() {
function removeDash() {
jQuery('.ff-el-progress-status').each(function() {
var text = jQuery(this).text().trim(); // Get the text content of the element
var newText = text.replace('-', ''); // Remove the dash
jQuery(this).text(newText); // Set the modified text back to the element
});
}
removeDash();
@iamrealfarhanbd
iamrealfarhanbd / Ninja Tables: Remove Google Sheet Redirection from Anchor Tags.js
Created April 2, 2024 06:04
This jQuery solution for Ninja Tables removes the portion "https://www.google.com/url?q=" from the href attribute of anchor tags within elements with the class "ninja_clmn_nm_product". It ensures that when using Ninja Tables with Google Sheets integration, the redirection notice from Google Sheets URLs is removed, providing a smoother user exper…
$(document).ready(function() {
// Function to remove the unwanted portion from href attribute
function removeUrlPortion() {
let $table = $('.ninja_clmn_nm_product');// Replace YourColumnKey With your column key like = .ninja_clmn_nm_YourColumnKey
$table.find('a').each(function() {
let href = $(this).attr('href');
// Check if href contains the unwanted portion
if (href.includes('https://www.google.com/url?q=')) {
// Remove the unwanted portion from href
@iamrealfarhanbd
iamrealfarhanbd / Prevent Text Selection for Ninja Tables.js
Created March 7, 2024 06:18
This Gist provides CSS and JavaScript code snippets to prevent users from copying content from a webpage by disabling text selection and right-click context menu. These measures can serve as a deterrent against unauthorized copying of website content. You can choose to implement either the CSS or JavaScript solution based on your preference.
// Disable text selection with css
#footable_parent_NT_ID {
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
pointer-events: none;
}
/*********************
add_filter('ninja_tables_before_update_settings', function ($columns, $tableId) {
function modifyData($columns) {
if (isset($_REQUEST['columns'])) {
return $_REQUEST['columns'];
} else {
return $columns;
}
}
@iamrealfarhanbd
iamrealfarhanbd / Conditional_Display_of_Download_Button_in_FluentForm.js
Last active January 5, 2024 12:06
jQuery code to conditionally display a download button (.nt_download_me) in FluentForm when a specific success class (.fluentform_18_success) is present. Ensures the button is shown only after the submit button is clicked and the success class is rendered
jQuery(document).ready(function ($) {
// Function to check if the success message is present
function checkSuccessMessage() {
jQuery('.kt-modal-content').each(function() {
if ($(this).find('.ff-message-success').length > 0) {
// Success message is present
$(this).find('.nt_download_me').show();
console.log('.nt_download button shown');
} else {
// Success message is not present