0

我有一个插件可以成功调用thickbox 来打开外部内容的iframe。它使用以下代码:

function user_avatar_admin_print_styles() {
    global $hook_suffix;
    wp_enqueue_script("thickbox");
    wp_enqueue_style("thickbox");
    wp_enqueue_style('user-avatar', plugins_url('/user-avatar/css/user-avatar.css'),
     'css');
    }

<a id="user-avatar-link" class="button-primary thickbox" href="<?php echo 
admin_url('admin-ajax.php'); ?>?action=user_avatar_add_photo&step=1&uid=<?php echo 
$profile->ID; ?>&TB_iframe=true&width=720&height=450" title="<?php _e('Upload and 
Crop an Image to be Displayed','user-avatar'); ?>" ><?php _e('Update Picture',
'user-avatar'); ?></a> 

所以重要的三个代码是 wp_enqueue_scriptwp_enqueue_style一个类都引用了thickbox。现在,Thickbox 完全搞乱了我的网站,并且不能很好地与我的其他插件交互。所以我决定使用colorbox...我只是将引用“thickbox”的三个代码更改为“colorbox”。听起来很简单,但插件中没有其他代码引用thickbox 接受我列出的三个。将代码更改为“colorbox”不起作用。我还尝试安装灯箱和灯箱加,然后更改代码.. 没有任何效果。

这个类“按钮主要厚盒”是否只适用于厚盒,还有更多吗?我可以更改代码以使用 colorbox、lightbox 或其他以相同方式工作的插件吗?任何帮助将不胜感激。:)

快速更新:

我在与类有关的thickbox 中发现了这段代码。我调用thickbox的插件使用代码

这是代码: function add_thickbox_class_to_attachment_link($link) { if (thickbox_get_option(OPTION_THICKBOX_ADD_CLASS) == false) return $link;

$use_smoothbox = thickbox_get_option(OPTION_THICKBOX_USE_SMOOTHBOX);
# Since SmoothBox doesn't come with WordPress we don't add the class here
if (use_wordpress_default_script_and_style() and $use_smoothbox == true)
    return $link;

$class = $use_smoothbox == true ? 'smoothbox' : 'thickbox';
return str_replace('<a', '<a class="'.$class.'"', $link);
}
if (function_exists('add_filter'))
add_filter('wp_get_attachment_link', 'add_thickbox_class_to_attachment_link');

我还发现使用带有颜色框的类,但它没有用。

4

1 回答 1

0

我最终使用了插件“PrettyPhoto”并简单地添加了代码

rel="PrettyPhoto" 

而不是调用插件的类。

于 2012-11-29T19:49:56.233 回答