0

I have a plugin that sucesfully calls thickbox to open an iframe of external content. It does it with the following codes:

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

and

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

So the important three codes are the wp_enqueue_script, wp_enqueue_style and the a class which all reference thickbox. Now, Thickbox completely messes up my website and doesn't interact with my other plugins well. So I decided to go with colorbox... I simply changed the three codes that referenced "thickbox" and changed them to "colorbox". It sounds simple, but there were no other codes in the plugin that reference thickbox accept the three that I listed. Changing the codes to "colorbox" did not work. I also tried installing lightbox, and lightbox plus and then changing the codes.. nothing worked.

Does this a class "button-primary thickbox" only work with thickbox, is there more to it then that? Can I change the code to work with colorbox, lightbox or some other plugin that acts the same way? Any help would truly be appreciated. :)

Quick Update:

I found this code within thickbox that has to do with a classes. My plugin that calls thickbox uses the code

Here is the code: 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');

I also found away to use a classes with colorbox, but it didn't work.

4

1 に答える 1

0

プラグイン「PrettyPhoto」を使用して、コードを追加するだけになりました

rel="PrettyPhoto" 

プラグインを呼び出すクラスの代わりに。

于 2012-11-29T19:49:56.233 に答える