Skip to content

Instantly share code, notes, and snippets.

@Qubadi
Qubadi / gist:a0ed35bcac7d8868ce39e0b8a6feccc6
Created June 27, 2025 19:02
JetBooking backend, change/translate status
Copy the following PHP and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
______________________________________
add_filter( 'jet-booking/statuses', function( $statuses ) {
$translations = [
'completed' => 'Godkjent',
'processing' => 'Behandler',
'on-hold' => 'På vent',
@Qubadi
Qubadi / gist:9eb8c903aa3fba7adcf800a81c814669
Last active June 23, 2025 17:38
JetEngine Dynamic field widget trim title/text+url link
Has developed a custom Trim Text with several new functionalities
( Dynamic field widget, Filter field output + Callback = JetEngine trim text) ,
including the ability to choose custom trim title/text for each device, and also toggle a link on the title/text.
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:9ed8cfff87d68493c71431a8d2226994
Created June 22, 2025 16:38
Jetformbuilder rename post-submit action labels
I've developed a custom code for JetFormBuilder post-submit action, which allows you to easily edit the label name,
something that's not possible by default in JetFormBuilder.
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:e245e954d8dd3e2357e923ede5df8aaa
Last active June 18, 2025 09:13
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.