16

How to Add a WPCodeBox Link to Your WordPress Admin Bar

Powered by WPCodeBox

This simple script adds an icon and text link for WPCodeBox to your WordPress Admin Bar, making it easier to access, especially with long menus. Enhance your WordPress workflow with this convenient WPCodeBox admin bar link.


<?php

function jfr_add_wpcodebox_admin_bar_icon($admin_bar)
{
    if (current_user_can("manage_options") && is_admin_bar_showing()) {
        $args = [
            "id" => "wpcodebox-main",
            "title" =>
                '<span class="ab-icon"></span><span class="ab-label">WPCodeBox</span>',
            "href" => get_admin_url() . "?page=wpcb_menu_page_php",
            "meta" => [
                "target" => "_self",
                "title" => "WPCodebox",
            ],
        ];
        $admin_bar->add_node($args);
    }
}

add_action("admin_bar_menu", "jfr_add_wpcodebox_admin_bar_icon", 999);
?>

<style>
#wp-admin-bar-wpcodebox-main .ab-icon:before {
    top:2px;
    content: "f499";
    }
</style>

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.