【问题标题】:Open a thickbox-style Lightbox from WP Admin Bar从 WP 管理栏打开一个厚盒式灯箱
【发布时间】:2012-02-20 01:39:27
【问题描述】:

伙计们,

我目前正在设置 WP 安装。为了让客户端访问自定义帮助文档,我通过以下 php 文件在管理栏中添加了一个额外的下拉菜单作为 WP 插件:

<?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')
        ));
    }
}

?>

下拉菜单工作正常,位于同一域的子域中的引用 html 文件在新选项卡中被调用。

但是,为了在 WP 管理中整齐地安排所有内容,我想通过 iframe 灯箱调用新管理栏下拉菜单中的菜单项。

我设法在仪表板介绍部分使用内置的厚框进行了设置,语法如下:

<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>

这让我可以将 html 帮助文件(或与此相关的任何其他 url)调用为厚盒样式覆盖中的 iframe。

现在是我的实际问题

有人可以指出我如何将管理栏下拉列表中的链接('Chapter 1' => 'http://manual.domain.com/index1.html', ...)设置为thickbox-样式覆盖而不是 target=_blank?

帮助非常感谢。非常感谢!

【问题讨论】:

  • 你有没有想过这个问题?谢谢。

标签: php wordpress admin thickbox


【解决方案1】:

'meta' => 数组('target' => '_blank'),

你忘记了“,

【讨论】:

  • 数组末尾的逗号?没有。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多