Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Shahjahan Jewel techjewel

🎯
Focusing
View GitHub Profile
@techjewel
techjewel / event-for-all-forms.js
Created Aug 6, 2020
Track Google Analytics event for all fluent forms in your site
View event-for-all-forms.js
(function($){
if(typeof gtag != 'function') {
return;
}
var fluentForms = $('form.frm-fluent-form');
fluentForms.each(function() {
var $form = $(this);
var formId = $form.attr('data-form_id');
gtag('event', 'ViewForm', {
View ninja_table_dynamic_data.php
<?php
/*
Plugin Name: Ninja Table Dynamic Data
Description: Dynamic Data Example For Ninja Tables
Version: 1.0.0
Author: WPManageNinja
Author URI: https://wpmanageninja.com/
Plugin URI: https://wpmanageninja.com/downloads/ninja-tables-pro-add-on/
License: GPLv2 or later
Text Domain: ninja_table_dynamic_data
@techjewel
techjewel / remove_ninjatables_scripts.php
Last active Nov 10, 2021
Dequeue Ninja Tables Scripts and Styles
View remove_ninjatables_scripts.php
<?php
// Add the following snippet to theme's functions.php to remove all the scripts loaded by ninja tables.
// Please note that, If you use this script then none of the Ninja Tables
// Features like search, sorting, pagination will work.
// Also, Your table need to be set as Legacy Render from Table Settings -> Configuration -> Rendering Settings.
add_action( 'wp_print_styles', function() {
wp_dequeue_style( "footable_styles" ); // Remove The Syyles
}, 100 );
@techjewel
techjewel / fluentform-radio-as-button.css
Created May 25, 2020
Fluent Forms Radio as Buttons
View fluentform-radio-as-button.css
// You can make the inline radio button look like button switch
// Steps:
// Add container class of the element "ff_button_style"
// Select Layout: Inline Layout
// Lastly add this css to custom css of the form
.ff-el-group.ff_list_inline.ff_button_style .ff-el-form-check {
background: #d2d2d2;
margin: 0 !important;
padding: 0 !important;
@techjewel
techjewel / protect_login_for_admin_roles.php
Last active Oct 28, 2021
Code snippet to reject login for admin/authors from the regular login url
View protect_login_for_admin_roles.php
<?php
/*
* Code snippet to reject login for admin/authors from the regular login url
* In this example, people who have edit_posts permission is require special url string to login
* The URL need to be: https://yourdomain.com/wp-login.php?salt=your_random_url_string
* For normal users they can login without the special salt
* But If author or admin try to login it will reject the authentication
*
*/
View ninja-tables-menu-change.php
<?php
add_action('admin_menu', function () {
global $menu;
foreach ($menu as $index => $menuItem) {
if(!empty($menuItem[2]) && $menuItem[2] == 'ninja_tables') {
$menu[$index][0] = 'My Tables';
}
}
}, 100);
@techjewel
techjewel / fluentcrom-meta-integration.php
Last active Oct 25, 2021
FluentCRM Meta Integration Control
View fluentcrom-meta-integration.php
<?php
/*
* FluentCRM Pro has integration with various plugin as WordPress Post/Settings meta.
* You can disable that by snippet and match plugin
*/
add_filter('fluentcrm_disable_integration_metaboxes', function($status, $plugin) {
$disableFluentCRMMeta = ['learndash','learnpress','lifterlms','tutorlms','woocommerce', 'edd'];
@techjewel
techjewel / FluentFormCustomImporter.php
Created Oct 23, 2021
Fluent Form Importer PHP Class
View FluentFormCustomImporter.php
<?php
class FluentFormCustomImporter
{
protected function getDemoForms()
{
return [
'[{"id":"9","title":"Contact Form Demo","status":"published","appearance_settings":null,"form_fields":{"fields":[{"index":0,"element":"input_name","attributes":{"name":"names","data-type":"name-element"},"settings":{"container_class":"","admin_field_label":"Name","conditional_logics":[]},"fields":{"first_name":{"element":"input_text","attributes":{"type":"text","name":"first_name","value":"","id":"","class":"","placeholder":"First Name"},"settings":{"container_class":"","label":"First Name","help_message":"","visible":true,"validation_rules":{"required":{"value":false,"message":"This field is required"}},"conditional_logics":[]},"editor_options":{"template":"inputText"}},"middle_name":{"element":"input_text","attributes":{"type":"text","name":"middle_name","value":"","id":"","class":"","placeholder":"","required":false},"settings":{"container_class":"","label":"Middle Name","help_message":"","error
@techjewel
techjewel / add_own_custom_forms_demo.php
Created Oct 21, 2021
Fluent Forms add custom Demo Forms
View add_own_custom_forms_demo.php
<?php
add_filter('fluentform_predefined_forms', function ($demoForms) {
$demoForms['nicolas_form_1'] = array(
'screenshot' => '', // You may add your form screenshot here
'createable' => true,
'title' => 'Form 1 by Nicolas',
'tag' => ["nicolas form"],
View new_form_submission_smartcode.php
<?php
/*
* Fluent Forms Extra Smartcodes on form integration feeds
* This code will add a new item on the smartcode dropdown.
* if you don't want to show the smartcode then you may skip this.
*/
add_filter('fluentform_form_settings_smartcodes', function ($groups) {
$groups[0]['shortcodes']['{my_custom_smartcode}'] = 'Custom All Data';