Skip to content

Instantly share code, notes, and snippets.

@marktenney
Last active February 22, 2019 15:50
Show Gist options
  • Save marktenney/4409b456d4f36ca454ff91a41e9d4de0 to your computer and use it in GitHub Desktop.
Save marktenney/4409b456d4f36ca454ff91a41e9d4de0 to your computer and use it in GitHub Desktop.
Create an Admin Edit Menu Dropdown under Wallace Inline
<?php
/*
Plugin Name: Wallace Inline Edit Submenu
Description: Contains Digital Church customizations to the admin section, including custom dashboard content and tweaks, custom adminbar content, and the intercom chat messenger. Should be network active.
Version: 1.0.1
Author: Digital Church
Author URI: https://digitalchurchplatform.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
// Check for active plugins
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
// check for wallace inline using plugin name
if ( is_plugin_active( 'wallace-inline/wallace-inline.php' ) ) {
// Add Edit Menu Items
add_action('admin_bar_menu', 'add_toolbar_items', 999);
function add_toolbar_items($admin_bar){
$admin_bar->add_menu( array(
'id' => 'wal-inline-frontend-edit-link',
'title' => 'Live Editor',
));
$admin_bar->add_menu( array(
'id' => 'edit',
'parent' => 'wal-inline-frontend-edit-link',
'title' => 'Page Settings',
'href' => '',
'meta' => array(
'class' => 'dgtl_admin_menu_class',
'html' => '<style>#wp-admin-bar-edit .ab-item::before
{display:none;}</style>',
'title' => 'Dashboard',
),
));
// check for beaver builder using plugin name
if ( is_plugin_active( 'bb-plugin/fl-builder.php' ) ) {
//plugin is activated
$admin_bar->add_menu( array(
'id' => 'fl-builder-frontend-edit-link',
'parent' => 'wal-inline-frontend-edit-link',
'title' => 'Advanced Editor',
'meta' => array(
'class' => 'dgtl_admin_menu_class',
'html' => '<style>.fl-builder-ab-tag{background:transparent;}#wp-admin-bar-fl-builder-frontend-edit-link .ab-submenu #wp-admin-bar-fl-theme-builder-frontend-edit-link .ab-item{border:0px;}.ab-icon{display:none}</style>'
),
));
}
// Add Customizer
$admin_bar->add_menu( array(
'id' => 'customize',
'parent' => 'wal-inline-frontend-edit-link',
'title' => 'Theme Options',
'meta' => array(
'class' => 'dgtl_admin_menu_class',
'html' => '<style>#wp-admin-bar-customize .ab-item::before
{display:none;}</style>',
'title' => 'Theme Options'
),
));
// Add Dashboard Button
$admin_bar->add_menu( array(
'id' => 'dgtl-dashboard',
'parent' => 'wal-inline-frontend-edit-link',
'title' => 'Dashboard',
'meta' => array(
'class' => 'dgtl_admin_menu_class',
'html' => '<style>#wp-admin-bar-customize .ab-item::before
{display:none;}</style>',
'title' => 'Dashboard'
),
));
// Add SG Cache Clearing
$admin_bar->add_menu( array(
'id' => 'SG_CachePress_Supercacher_Purge',
'parent' => 'wal-inline-frontend-edit-link',
'title' => 'Clear Server Cache',
'meta' => array(
'class' => 'dgtl_admin_menu_class',
'html' => '',
'title' => 'Clear Server Cache'
),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment