Oxygen Links in Admin Bar

Arshad
8 Jul 2022

I put this code-snippet to every Oxygen site i develop, because it is faster to go to the settings by admin bar,
I use Scripts Organizer to use this as below :

  1. Add a code-block with Trigger location set to EVERYWHERE
  2. put the code and you are done.
<?php
add_action('admin_bar_menu', function (WP_Admin_Bar $admin_bar) {
    if (!current_user_can('manage_options')) {return;}
    include_once ABSPATH . 'wp-admin/includes/plugin.php';

    // OXYGEN
    if (is_plugin_active('oxygen/functions.php')) {
        $admin_bar->add_menu(array(
            'id'    => 'arsh-oxy-menu',
            'title' => 'Oxygen Links',
            // 'href' => '#',
        ));
        $admin_bar->add_menu(array(
            'parent' => 'arsh-oxy-menu',
            'id'     => 'clear-oxy-css-cache-link',
            'title'  => 'Oxygen CSS Cache',
            'href'   => admin_url('admin.php?page=oxygen_vsb_settings&tab=cache&start_cache_generation=true'),
        ));
        $admin_bar->add_menu(array(
            'parent' => 'arsh-oxy-menu',
            'id'     => 'sign-oxy-shortcode-link',
            'title'  => 'Sign Shortcodes',
            'href'   => admin_url('admin.php?page=oxygen_vsb_sign_shortcodes'),
        ));
        $admin_bar->add_menu(array(
            'parent' => 'arsh-oxy-menu',
            'id'     => 'design-sets-link',
            'title'  => 'Design Sets',
            'href'   => admin_url('admin.php?page=oxygen_vsb_settings&tab=library_manager'),
        ));
    }

}, 10000);

Was this article helpful?

Tags

Categories

Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy