Skip to content

Instantly share code, notes, and snippets.

@Qubadi
Qubadi / gist:5793d9bd3fbc996fb35cee7e50031f33
Last active February 1, 2025 20:23
Jetformbuilder customize the Choose File and drag-and-drop of images
UPDATED: 04.11.2024
Copy the following HTML code and create a HTML snippet using your snippet plugins.
Paste the code into the plugin and save it.
Don't forget to add MIME types (image formats), for example, PNG and JPEG, in the media field where it shows 'Allow MIME types.
______________________________________________________
<style>
/* Custom styles for the file upload field */
.jet-form-builder__field-wrap.jet-form-builder-file-upload {
@Qubadi
Qubadi / gist:e2ce7959b1400379d596a59c259ec8c0
Last active March 16, 2025 12:45
Randomized thank you page redirect with unique slug
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Changes page ids: function add_specific_rewrite_rule_for_thank_you_page() {
// Get the post ID for your thank-you page
$thank_you_page_id = YOUR PAGE ID;
and: function handle_thank_you_page_redirection() {
// Define the post ID for your thank-you page
$thank_you_page_id = YOUR PAGE ID;
@Qubadi
Qubadi / gist:b9a61f5c43a9f4a3f787d97e53107c60
Created August 30, 2024 23:10
Jetformbuilder: Contact form, Jetbooking and Jetappointment, hide labels or titles when fields are empty
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Hide labels or titles when fields are empty ( Send email action - content )
Add this shortcode name to Send email post action ( content )
[display_if_not_empty field="%your field name%" label="Your label name:"]
Repeat this process until all the fields
and the respective labels have been entered in each shortcode name. You may include as many as you want.
________________________________________
@Qubadi
Qubadi / gist:291ae99b98b11a563df881b906e401e7
Created August 24, 2024 18:32
Visitor tracker in WordPress with real-time only visible for admins
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Visitor tracker in WordPress with real-time updates and a smooth pop-up for admins.
___________________________________-
// Hook to add the visitor tracking and popup for admins
add_action('wp_footer', 'admin_visitor_tracker');
@Qubadi
Qubadi / gist:ecc4e8db265ef2f2e642120bac2a8ef2
Last active September 5, 2024 12:01
JetEngine profilebuilder, profile view counter
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
Add the [user_profile_view_count] shortcode to your profile single page
Custom JetEngine code that shows the view count of every profile in ProfileBuilder.
______________________________________
@Qubadi
Qubadi / gist:988f31fee7aaf292583a7ac73366db25
Last active August 23, 2024 12:17
Optimize your WordPress site with custom 301 redirect handling
Copy the following PHP code and create a PHP snippet using your snippet plugins.
Paste the code into the plugin and save it.
This code snippet will help you to easily manage all 301 redirects and so simply redirect your old links on new directly
from wordpress admin. By using these redirects you can ensure that both human and search engine traffic gets sent to the
appropriate pages wich helps maintain your SEO value as well improve user experience. The snippet also incorporates caching
to ease up on database load which helps keep your site fast and efficient. It is simply a functional way of preserving the
integrity of your sites links all integrated without needing additional plugins, so you can maintain an easy and straight
forward workflow.
@Qubadi
Qubadi / gist:bfbc6e17c252a6340a45c089b0f55dd4
Last active October 2, 2024 20:30
WordPress current view tracker for Posts, CPTs, and Products
UPDATED: 11-08-2024
The code has been updated to address the concerns:
Nonce verification has been added to protect against CSRF attacks and ensure that only authorized requests are processed.
Input validation and sanitization are now in place for post_id and user_token to prevent malicious data from being processed.
XSS protection has been implemented by escaping all outputs before they are inserted into the DOM.
LocalStorage usage has been reviewed and is handled appropriately given the context.
Description:
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:2e158f1e4d67cccb4d41743bc66ca871
Last active December 13, 2024 02:14
JetFormBuilder: Confirmation popup on form submission
UPDATED: 23.08.2024
Description:
Copy the following JS code and create a JS snippet using your snippet plugins.
Paste the code into the plugin and save it.
I have appended the submit button with a class name called submit_confirm.
The advantage of this class is that it will only affect the form that holds the submit_confirm class and not any other forms,
in case you have many forms.
@Qubadi
Qubadi / gist:4e312e4fe5fb82f05d965616365d3a4d
Created August 8, 2024 23:20
Jetformbuilder content Template with RTL and Amiri font
Add this HTML code to your Jetformbuilder (Send Email) content, and do not forget to add your field names.
If you have more field names, just duplicate the code lines.
This template is designed for use with Jetformbuilder, featuring RTL (Right-to-Left)
text alignment and the elegant Amiri font. The template ensures proper rendering of text in
languages that read from right to left, such as Arabic. Simply add your content within the designated section,
and the template will automatically apply the specified font and alignment styles.
<style>
@Qubadi
Qubadi / gist:da08ced02431169768e558483c4bf099
Last active September 5, 2024 12:02
Enhanced input fields with clear button for JetFormBuilder
Updates Made 31.08.2024:
Used input.onClear(): This method is used to clear the input field when available.
Checked for Input Type: Added a check to skip adding the clear button for checkbox and radio input types to avoid issues.
Description:
Copy the following HTML code and create a HTML snippet using your snippet plugins. Paste the code into the plugin and save it.
This code enhances the input fields in JetFormBuilder forms by adding a clear button that allows users to easily clear the input content.
The clear button appears when there is input and disappears when the input is empty. It also includes a smooth hover effect for the
clear button, changing its background and font colors.