Skip to content

Instantly share code, notes, and snippets.

View Dilip7597's full-sized avatar
🎯
Focusing

Dilip Gupta Dilip7597

🎯
Focusing
View GitHub Profile
@Dilip7597
Dilip7597 / functions.php
Last active October 15, 2019 14:20
Hide Dashboard Notification for all users except Admin for WordPress.
function dsourc_hide_notices(){
$user = wp_get_current_user();
if (!($user->roles[0] == 'administrator')) {
remove_all_actions( 'admin_notices' );
}
}
add_action( 'admin_head', 'dsourc_hide_notices', 1 );
@Dilip7597
Dilip7597 / event.php
Last active August 24, 2018 15:31
Bootstrap 4 - Multiple Modal on same page with
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
array(
'id' => $prefix . 'address',
'type' => 'text',
'name' => esc_html__( 'Address', 'star' ),
),
array(
'id' => $prefix . 'location',
'type' => 'map',
'name' => esc_html__( 'Location', 'star' ),
'address_field' => $prefix . 'address',
array(
'id' => $prefix . 'location',
'type' => 'group',
'name' => esc_html__( 'Location', 'star' ),
'fields' => array(
array(
'id' => $prefix . 'address',
'type' => 'text',
'name' => esc_html__( 'Address', 'star' ),
),
@Dilip7597
Dilip7597 / show_meta_info.php
Created May 14, 2018 12:41
dealing with MB Group plugin. just copy both functions into your functions.php file and you are ready to get the dynamic value.
<?php
// Function to get the sub-field values from groupped meta fields.
function sk_meta($group, $field){
$group = rwmb_meta($group);
$value = isset($group[$field]) ? $group[$field] : '' ;
return $value;
}