Skip to content

Instantly share code, notes, and snippets.

@Qubadi
Qubadi / gist:e245e954d8dd3e2357e923ede5df8aaa
Last active March 15, 2025 20:50
JetFormbuilder: Rename uploaded image filename and title based on post title
The JetFormBuilder custom code automatically changes the uploaded image filename and title based on the post title.
It also supports multiple image uploads as well as meta field media, such as galleries, etc.
Here’s what you need to do first (no need to change anything in the code):
Create a post action in the JetFormBuilder form, select "Call Hook", and name it: image_title.
IMPORTANT: MAKE SURE YOU ADD THE CALL HOOKS ACTION AT THE BOTTOM AND NOT AT THE TOP.
Copy the following PHP and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
@Qubadi
Qubadi / gist:5fc5f75bdccfb52c364c1bbf70d7cbbe
Created February 9, 2025 12:38
Jetformbuilder: Phone number fix, only allow numbers in tel fields
We have developed a code for telephone input numbers, where it only allows users to type in numbers.
On phones and tablets, it automatically shows the number keyboard when you try to type in the field,
instead of the full keyboard.
By using the Set Input Mask option, you can restrict input to numbers. However, on phones and tablets,
the full keyboard still appears when trying to enter a value in a telephone input field. Normally,
it should only display the number keyboard instead of the full keyboard.
In JetFormBuilder, this does not work as expected by default. When a telephone input is selected,
it should trigger the number keyboard, but it doesn't.
@Qubadi
Qubadi / gist:5dfa5133f85ec2a9e62867f024f04969
Last active January 28, 2025 17:36
Custom code to disable auto-fill for JetFormBuilder fields ( Disable autofill for a specific form by adding its ID to the code )
UPDATED: 28.01.2025
This custom code is designed to effectively prevent auto-fill on JetFormBuilder forms, as well as other forms,
by dynamically altering the name attributes of input fields. When the page loads, it temporarily changes the name
attributes of visible inputs, text areas, and selects, and sets autocomplete to new-password to stop browsers from
auto-filling the fields.
During form submission, the original names are restored for accurate data handling. After submission, the name
attributes are randomized again to ensure auto-fill remains disabled in future interactions. This approach is ideal
for situations where you need to prevent unintended auto-completion by browsers while still preserving the correct
@Qubadi
Qubadi / gist:0ec7851e0621334de5a2aee595216510
Last active January 28, 2025 17:34
Custom code to disable auto-fill for JetFormBuilder fields ( Disable autofill for all fields in all forms )
UPDATED: 28.01.2025
This custom code is designed to effectively prevent auto-fill on JetFormBuilder forms, as well as other forms,
by dynamically altering the name attributes of input fields. When the page loads, it temporarily changes the name
attributes of visible inputs, text areas, and selects, and sets autocomplete to new-password to stop browsers from
auto-filling the fields.
During form submission, the original names are restored for accurate data handling. After submission, the name
attributes are randomized again to ensure auto-fill remains disabled in future interactions. This approach is ideal
for situations where you need to prevent unintended auto-completion by browsers while still preserving the correct
@Qubadi
Qubadi / gist:bf450f2678e83cb1a260f6832de96dde
Last active January 10, 2025 18:11
Wordpress: CPT management and user post count display
The code here creates a secure WordPress admin page for managing the slugs of CPTs.
Administrators can add, remove, and save CPT slugs that will be used to display post counts for each CPT in the user list table.
This functionality is secure and integrates seamlessly with WordPress.
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Then, after that, go to CPT Settings in the toolbar dashboard of WordPress, and add all your CPT slug names there,
and click Save. After that, go to Users, and then All Users. There, you will see the CPT and posts counts.
__________________________________________
@Qubadi
Qubadi / gist:c413c2dfec5f5227100392bc99756ce5
Last active January 6, 2025 11:41
User approval system for Wordpress
Description:
This code implements a secure user approval system for WordPress, allowing administrators to manage user access based on approval status.
New users are marked as “pending approval” by default, preventing any login until they are approved.
When a user is approved by an administrator, they automatically receive an email containing their login URL and further instructions.
Administrators can approve or unapprove users directly from the admin panel, with real-time session termination for unapproved accounts.
The system is compatible with all login methods, employs nonce-based security for critical actions, and excludes administrators
from approval workflows.
These two lines need to be updated with your own URLs:
@Qubadi
Qubadi / gist:7b559c26a4442373b942664dc4c38ff3
Last active February 25, 2025 18:20
Dynamic posts per page adjustment for JetEngine Query Builder's Posts Query based on device type
As we know, JetEngine Query Builder's Posts Query Posts Per Page doesn’t have an option to set different posts per page
based on the device, like tablet and phone. Now we have developed a custom code to achieve it, allowing dynamic
adjustments based on the user’s device type.
The code only works for Posts Query and must be implemented correctly within
JetEngine Query Builder, it works whether the Cache Query toggle is on or off.
How to do it:
1. Go to Query Builder, create a new query, and select Query Type: Posts Query.
@Qubadi
Qubadi / gist:3c12e21d4572ca9fae05670169e8a455
Created December 13, 2024 23:40
JetFormBuilder form validation with disabled submit button
It checks to see if a JetFormBuilder form has all required fields filled.
If any of them are missing, the submit button is disabled, and this prevents their submission.
The button activates again when all fields are complete.
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
________________________________________
add_action('wp_footer', function () {
@Qubadi
Qubadi / gist:2ec33798ddeed715b3060c47ba498ee2
Last active December 16, 2024 15:50
JetEngine Listing grid title
We have developed a custom code that adds a new feature to the default JetEngine Listing Grid widget in Elementor.
This enhancement allows users to easily add a title or label directly from Elementor's controls. With full styling options,
including alignment, typography, colors, and spacing, the label integrates seamlessly with the existing widget for a dynamic
and customizable experience.
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
________________________________________
@Qubadi
Qubadi / gist:b918070aaf15f1e48b0b2ad9baeeb117
Last active April 7, 2025 16:47
JetFormBuilder that allows users to crop images with some great new functionality
UPDATED: 29.09.2024
Copy the following HTML code and create a HTML snippet using your snippet plugins.
Paste the code into the plugin and save it.
I’ve developed a new custom feature for JetFormBuilder that allows users to crop images with some great new functionality.
Here’s a quick rundown of what it does:
JetFormBuilder integration: This custom code integrates seamlessly with JetFormBuilder’s file upload system, making the image
inputs interactive and ready for cropping, all through a custom action hook.