Skip to content

Instantly share code, notes, and snippets.

View hazratbilal0079's full-sized avatar
💭
I may be slow to respond.

Hazrat Bilal hazratbilal0079

💭
I may be slow to respond.
View GitHub Profile
@hazratbilal0079
hazratbilal0079 / CSS
Created September 23, 2024 11:50
Inline Editing of CPT or CCT using bricks or Elementor
#inlinetrytable {
width: 100%;
border-collapse: collapse;
}
#inlinetrytable th, #inlinetrytable td {
padding: 10px;
border: 1px solid #ddd;
text-align: left;
}
@hazratbilal0079
hazratbilal0079 / CSS
Created September 23, 2024 12:25
Editing with popup of a CPT and CCT
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 25%;
top: 0;
width: 50%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
@hazratbilal0079
hazratbilal0079 / gist:c544f348a974a462d7586a7350a09bcc
Created September 25, 2024 07:38
Add Custom Roles in WordPress website
function add_custom_roles_via_snippet() {
// Capabilities for CEO, Operational Manager, and Listing Manager
$full_capabilities = array(
'edit_post' => true,
'edit_others_posts' => true,
'delete_post' => true,
'delete_others_posts' => true,
'publish_posts' => true,
'read_post' => true,
'publish_others_posts' => true,
@hazratbilal0079
hazratbilal0079 / gist:f10edaf2567ac054cc6bbfc7c30e40c1
Created September 29, 2024 06:49
Add Custom role from frontend using php hook
hook name: registernewrole
Hook:
add_action( 'jet-form-builder/custom-action/registernewrole', 'register_new_user_role', 10, 2 );
function register_new_user_role( $request, $handler ) {
// Get the role name from the form field (assuming the field name is 'role_name')
$role_name = isset( $request['role_name'] ) ? sanitize_text_field( $request['role_name'] ) : '';
// Get the capabilities from the form field (assuming the field name is 'select_capabilities')
$capabilities = isset( $request['select_capabilities'] ) ? array_map( 'sanitize_text_field', (array) $request['select_capabilities'] ) : [];
@hazratbilal0079
hazratbilal0079 / Hide Columns based on the user role and get the user role through php
Created October 10, 2024 11:42
Display and Hide Columns based on the user role using Data tables
// Function to display the current user's role
function display_current_user_role_shortcode() {
// Check if a user is logged in
if ( is_user_logged_in() ) {
// Get the current user's data
$current_user = wp_get_current_user();
// Retrieve the user's roles
$roles = $current_user->roles;
@hazratbilal0079
hazratbilal0079 / gist:81dfb7e40f2a9a04951a5e0994ec17b9
Created April 4, 2025 13:19
Create Zoom Meeting in wordpress Through Hook and insert in the post type meta fields
add_action('jet-form-builder/custom-action/generatezoomclass', function ($request, $action_handler) {
global $wpdb;
$post_id = isset($request['inserted_post_id']) ? intval($request['inserted_post_id']) : 0;
$zoom_account_id = "your_zoom_account_id";
$zoom_client_id = "your_zoom_client_id";
$zoom_client_secret = "your_zoom_client_password";
if (!$post_id) {
$action_handler->add_error('post_id', 'Post ID is missing.');