Open a thickbox-style Lightbox from WP Admin Bar

Folks,

I’m currently setting up a WP install. In order for the client to access a custom help-document, I added an additional dropdown menu in the admin-bar as a WP plugin via the following php-file:

Read More
<?php

function pub_admin_bar_init() {
    if (!is_super_admin() || !is_admin_bar_showing() )
        return;

    add_action('admin_bar_menu', 'pub_admin_bar_links', 500);
}

add_action('admin_bar_init', 'pub_admin_bar_init');

function pub_admin_bar_links() {
    global $wp_admin_bar;

    $links = array(
        'Chapter 1' => 'http://manual.domain.com/index1.html',
        'Chapter 2' => 'http://manual.domain.com/index2.html',
        'Chapter 3' => 'http://manual.domain.com/index3.html',
        'Chapter 4' => 'http://manual.domain.com/index4.html',
        'Chapter ...' => 'http://manual.domain.com/index5.html',
    );

    $wp_admin_bar->add_menu( array(
        'title' => 'Help-Document',
        'href' => false,
        'id' => 'pub_links',
        'href' => false
    ));

    foreach ($links as $label => $url) {
        $wp_admin_bar->add_menu( array(
            'title' => $label,
            'href' => $url,
            'parent' => 'pub_links',
            'meta' => array('target' => '_blank')
        ));
    }
}

?>

The dropdown works fine and the referenced html-files located in the subdomain of the same domain get called in a new tab.

However, in order to have everything neatly arranged within the WP admin, I’d like to call the menu items in the new admin-bar dropdown via an iframe Lightbox.

I managed to set this up in the Dashboard intro section using the built-in thickbox with the following syntax:

<a style="text-decoration:none;" 
href="http://codex.wordpress.org/First_Steps_With_WordPress?
keepThis=true&TB_iframe=true&height=800&width=1200" class="thickbox" 
title="sometitle">First Steps with WordPress</a>

This lets me call the html help-files (or any other url for that matter) as an iframe in a thickbox-style overlay.

Now my actual question:

Could someone point me to how I could make the links in the admin-bar dropdown (‘Chapter 1’ => ‘http://manual.domain.com/index1.html’, …) as thickbox-style overlays instead of target=_blank?

Help very much appreciated. Thanks a lot!

Related posts

Leave a Reply

1 comment