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 / 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: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 / 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 / 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 / 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 11, 2024 12:31
Grid Card layout with fixed Background in HTML and CSS
.fixed-overlay-card {
position: relative;
width: 100%;
max-width: 1200px; /* Adjust as needed */
height: 420px;
margin-bottom: 20px; /* Space between cards */
border-radius: 8px;
overflow: hidden;
display: flex;
align-items: center;
@hazratbilal0079
hazratbilal0079 / CSS
Created September 11, 2024 12:30
On Mouse Over Display Details Card layout in Html and CSS
.overlay-card {
position: relative;
width: 100%;
max-width: 1200px; /* Adjust as needed */
height: 420px;
margin-bottom: 20px; /* Space between cards */
border-radius: 8px;
overflow: hidden;
}
@hazratbilal0079
hazratbilal0079 / gist:ade5f52832e5f587090bc9276dea4405
Created September 11, 2024 12:28
Accordion card layout in HTML and CSS
<div class="card accordion">
<div class="card-image">
<img src="https://vipprops.ae/wp-content/uploads/jet-form-builder/2172fde49301047270b2897085e4319d/2024/09/Ocean-terrace.jpg" alt="Ocean Terrace">
</div>
<div class="card-content">
<h3>Hazrat Bilal Timber/Twing Accordion Card Layout 03</h3>
<div class="accordion-sections">
<div class="accordion-section">
<input type="checkbox" id="section1" class="accordion-toggle">
<label for="section1" class="accordion-header">Section 1</label>
@hazratbilal0079
hazratbilal0079 / css file
Created September 11, 2024 12:26
Mansory Card layout in HTML and CSS
.masonry-horizontal {
display: flex;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 8px;
overflow: hidden;
height: 100%;
}
.masonry-image {
@hazratbilal0079
hazratbilal0079 / css file
Last active September 11, 2024 12:23
Tabbed card layout in Html/CSS
.card.tabbed {
display: flex;
border: 1px solid #ddd;
border-radius: 8px;
overflow: hidden;
background: #fff;
margin: 20px;
}