cat_ID; endforeach; $needle = explode(',', $options['global_settings']['lightbox_gallery_categories']); foreach ( $needle as $val ) : if ( in_array($val, $cats ) ) : $flag = true; break; endif; endforeach; elseif ( !empty($options['global_settings']['lightbox_gallery_pages']) && is_page() ) : $needle = explode(',', $options['global_settings']['lightbox_gallery_pages']); foreach ( $needle as $val ) : if ( trim($val) == $wp_query->queried_object_id ) : $flag = true; break; endif; endforeach; else : if ( $wp_query->posts ) : for($i=0;$iposts);$i++) : if ( preg_match('/\[gallery([^\]]+)?\]/', $wp_query->posts[$i]->post_content) || preg_match('/]*>/',$wp_query->posts[$i]->post_content) ) : $flag = true; break; endif; endfor; endif; endif; if ( !is_admin() && $flag ) { if ( empty($options['global_settings']['lightbox_gallery_disable_lightbox_gallery_css']) ) : if (@file_exists(STYLESHEETPATH.'/lightbox-gallery.css')) { echo ''."\n"; } else { echo ''."\n"; } endif; } } function lightbox_gallery_wp_print_scripts() { $options = get_option('lightbox_gallery_data'); if ( isset($options['global_settings']['lightbox_gallery_script_loading_point']) && $options['global_settings']['lightbox_gallery_script_loading_point'] == 'footer' ) $in_footer = true; else $in_footer = false; if ( !defined('WP_PLUGIN_DIR') ) $plugin_dir = str_replace( ABSPATH, '', dirname(__FILE__) ); else $plugin_dir = dirname( plugin_basename(__FILE__) ); $flag = lightbox_gallery_return_the_flag(); if ( !is_admin() && $flag ) : $template = get_template(); wp_enqueue_script( 'jquery' ); if ( $options['global_settings']['lightbox_gallery_loading_type'] == 'highslide' ) : if ( file_exists(ABSPATH . '/' . PLUGINDIR . '/' . $plugin_dir . '/js/highslide.js') ) : wp_enqueue_script( 'highslide', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/highslide.js', false, '', $in_footer ); elseif ( file_exists(STYLESHEETPATH.'/highslide.js') ) : wp_enqueue_script( 'highslide', WP_CONTENT_DIR . '/themes/' . $template . '/highslide.js', array('jquery'), '', $in_footer ); endif; elseif ( $options['global_settings']['lightbox_gallery_loading_type'] == 'lightbox' ) : if ( file_exists(ABSPATH . '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.lightbox.js') ) : wp_enqueue_script( 'lightbox', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.lightbox.js', array('jquery'), '', $in_footer ); elseif ( file_exists(STYLESHEETPATH.'/jquery.lightbox.js') ) : wp_enqueue_script( 'lightbox', WP_CONTENT_DIR . '/themes/' . $template . '/jquery.lightbox.js', array('jquery'), '', $in_footer ); endif; //wp_enqueue_script( 'dimensions', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.dimensions.js', array('jquery'), '', $in_footer ); wp_enqueue_script( 'bgiframe', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.bgiframe.js', array('jquery'), '', $in_footer ) ; else : wp_enqueue_script( 'colorbox', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.colorbox.js', array('jquery'), '', $in_footer ); endif; wp_enqueue_script( 'tooltip', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.tooltip.js', array('jquery'), '', $in_footer ); if ( @file_exists(STYLESHEETPATH.'/lightbox-gallery.js') ) : wp_enqueue_script( 'lightbox-gallery', STYLESHEETPATH . '/lightbox-gallery.js', array('jquery'), '', $in_footer ); else : wp_enqueue_script( 'lightbox-gallery', '/' . PLUGINDIR . '/' . $plugin_dir . '/lightbox-gallery.js', array('jquery'), '', $in_footer ); endif; endif; } function lightbox_gallery_wp_print_styles() { $options = get_option('lightbox_gallery_data'); if ( isset($options['global_settings']['lightbox_gallery_loading_type']) && $options['global_settings']['lightbox_gallery_loading_type'] == 'colorbox' ) : $options['global_settings']['lightbox_gallery_colorbox_css'] = !empty($options['global_settings']['lightbox_gallery_colorbox_css']) ? $options['global_settings']['lightbox_gallery_colorbox_css'] : 'example1'; wp_enqueue_style( 'colorbox', plugins_url('colorbox/'.$options['global_settings']['lightbox_gallery_colorbox_css'].'/colorbox.css', __FILE__) ); endif; } function lightbox_gallery_return_the_flag() { global $wp_query; $options = get_option('lightbox_gallery_data'); $flag = false; if ( !empty($options['global_settings']['lightbox_gallery_enforce_loading_scripts']) ) : $flag = true; elseif ( !empty($options['global_settings']['lightbox_gallery_categories']) && (is_category() || is_single() ) ) : $categories = get_the_category(); $cats = array(); foreach( $categories as $val ) : $cats[] = $val->cat_ID; endforeach; $needle = explode(',', $options['global_settings']['lightbox_gallery_categories']); foreach ( $needle as $val ) : if ( in_array($val, $cats ) ) : $flag = true; break; endif; endforeach; elseif ( !empty($options['global_settings']['lightbox_gallery_pages']) && (is_page() ) ) : $needle = explode(',', $options['global_settings']['lightbox_gallery_pages']); foreach ( $needle as $val ) : if ( trim($val) == $wp_query->queried_object_id ) : $flag = true; break; endif; endforeach; else : if ( $wp_query->posts ) : for($i=0;$iposts);$i++) : if ( isset($wp_query->posts[$i]->post_content) && (preg_match('/\[gallery([^\]]+)?\]/', $wp_query->posts[$i]->post_content) || preg_match('/]*>/',$wp_query->posts[$i]->post_content)) ) : $flag = true; break; endif; endfor; endif; endif; return $flag; } function lightbox_gallery_print_path_header() { $options = get_option('lightbox_gallery_data'); if ( isset($options['global_settings']['lightbox_gallery_script_loading_point']) && $options['global_settings']['lightbox_gallery_script_loading_point'] == 'footer' ) return; $flag = lightbox_gallery_return_the_flag(); if ( !is_admin() && $flag ) : echo ''."\n"; endif; } function lightbox_gallery_print_path_footer() { $options = get_option('lightbox_gallery_data'); if ( empty($options['global_settings']['lightbox_gallery_script_loading_point']) || $options['global_settings']['lightbox_gallery_script_loading_point'] != 'footer' ) return; $flag = lightbox_gallery_return_the_flag(); if ( !is_admin() && $flag ) : echo ''."\n"; endif; } function lightbox_gallery_plugin_action_links($links, $file){ static $this_plugin; if( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__); if( $file == $this_plugin ){ $settings_link = '' . __('Settings') . ''; $links = array_merge( array($settings_link), $links); } return $links; } function lightbox_gallery_media_send_to_editor($html) { $options = get_option('lightbox_gallery_data'); if ( !empty($options['global_settings']['lightbox_gallery_auto_lightbox_addition']) ) : $html = preg_replace('//', '', $html); endif; return $html; } function lightbox_gallery_admin_menu() { add_options_page(__('Lightbox Gallery', 'lightbox-gallery'), __('Lightbox Gallery', 'lightbox-gallery'), 'manage_options', basename(__FILE__), 'lightbox_gallery_admin'); } function lightbox_gallery_admin() { global $wp_version; $locale = get_locale(); $options = get_option('lightbox_gallery_data'); if( !empty($_POST["lightbox_gallery_global_settings_submit"]) ) : unset($options['global_settings']); foreach($_POST as $key => $val) : if($key != "lightbox_gallery_global_settings_submit") : if ( is_array($val) ) $options['global_settings'][$key] = $val; else $options['global_settings'][$key] = stripslashes($val); endif; endforeach; update_option('lightbox_gallery_data', $options); $message = __('Options updated.', 'lightbox-gallery'); elseif ( !empty($_POST['lightbox_gallery_delete_options_submit']) ) : delete_option('lightbox_gallery_data'); $options = get_option('lightbox_gallery_data'); $message = __('Options deleted.', 'lightbox-gallery'); elseif ( !empty($_POST['lightbox_gallery_script_auto_download_submit']) ) : if ( !defined('WP_PLUGIN_DIR') ) $plugin_dir = str_replace( ABSPATH, '', dirname(__FILE__) ); else $plugin_dir = dirname( plugin_basename(__FILE__) ); $lightbox = @file_get_contents('http://wpgogo.com/jquery.lightbox.js'); $highslide = @file_get_contents('http://wpgogo.com/highslide.js'); if ( !empty($lightbox) && !empty($highslide) && file_put_contents(ABSPATH . '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.lightbox.js', $lightbox) && file_put_contents(ABSPATH . '/' . PLUGINDIR . '/' . $plugin_dir . '/js/highslide.js', $highslide) ) : $message = __('Scripts downloaded.', 'lightbox-gallery'); else : $message = __('Download failed.', 'lightbox-gallery'); endif; endif; if ( !defined('WP_PLUGIN_DIR') ) $plugin_dir = str_replace( ABSPATH, '', dirname(__FILE__) ); else $plugin_dir = dirname( plugin_basename(__FILE__) ); ?>




:


  • download the lightbox script and put `jquery.lightbox.js` into `/lightbox-gallery/js/`.', 'lightbox-gallery'), 'http://wpgogo.com/jquery.lightbox.js'); ?>

  • Please look at the author\'s website.', 'lightbox-gallery'), 'http://highslide.com/'); ?>
  • download the highslide script and put `highslide.js` into `/lightbox-gallery/js/`.', 'lightbox-gallery'), 'http://wpgogo.com/highslide.js'); ?>

:


Colorbox official site in detail.', 'lightbox-gallery'), 'http://www.jacklmoore.com/colorbox/'); ?>
ex) transition:'fade', slideshow:true

:


query_vars['page']) ? $wp_query->query_vars['page'] : 1; $html5 = current_theme_supports( 'html5', 'gallery' ); extract(shortcode_atts(array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => $html5 ? 'figure' : 'dl', 'icontag' => $html5 ? 'div' : 'dt', 'captiontag' => $html5 ? 'figcaption' : 'dd', 'columns' => $columns, 'size' => $size, 'include' => '', 'exclude' => '', 'lightboxsize' => $lightboxsize, 'meta' => 'false', 'class' => 'gallery1', 'nofollow' => false, 'from' => '', 'num' => '', 'page' => $page, 'before' => '', 'link_before' => '', 'link_after' => '', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'pagenavi' => 1, 'colorbox_settings' => $colorbox_settings ), $attr)); $id = intval($id); if ( 'RAND' == $order ) $orderby = 'none'; if ( !empty($include) ) { $include = preg_replace( '/[^0-9,]+/', '', $include ); $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( !empty($exclude) ) { $exclude = preg_replace( '/[^0-9,]+/', '', $exclude ); $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); } else { $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); } if ( empty($attachments) ) return ''; $total = count($attachments)-(int)$from; if ( !$page ) $page = 1; $numpages = 1; if ( is_numeric($from) && !$num ) : $attachments = array_splice($attachments, $from); elseif ( is_numeric($page) && is_numeric($num) && $num>0 ) : if ( $total%$num == 0 ) $numpages = (int)($total/$num); else $numpages = (int)($total/$num)+1; $attachments = array_splice($attachments, ($page-1)*$num+$from, $num); endif; if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $id => $attachment ) $output .= wp_get_attachment_link($id, $size, true) . "\n"; return $output; } $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; $gallery_style = $gallery_div = ''; if ( empty($options['global_settings']['lightbox_gallery_disable_column_css']) ) : if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) $gallery_style = " "; endif; $size_class = sanitize_html_class( $size ); $gallery_div = "\n"; $output .= wp_link_pages_for_lightbox_gallery(array('before' => $before, 'after' => $after, 'link_before' => $link_before, 'link_after' => $link_after, 'next_or_number' => $next_or_number, 'nextpagelink' => $nextpagelink, 'previouspagelink' => $previouspagelink, 'pagelink' => $pagelink, 'page' => $page, 'numpages' => $numpages, 'pagenavi' => $pagenavi)); return $output; } function wp_link_pages_for_lightbox_gallery($args = '') { global $post; $defaults = array( 'echo' => 0, 'page' => 1, 'numpages' => 1 ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); if ( !$pagenavi ) return; if ( $numpages > $page ) $more = 1; $output = ''; if ( $numpages > 1 ) { if ( 'number' == $next_or_number ) { $output .= $before; for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { $j = str_replace('%',"$i",$pagelink); $output .= ' '; if ( ($i != $page) || (empty($more) && ($page==1)) ) { if ( 1 == $i ) { $output .= ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= ''; else $output .= ''; } } else { $output .= ''; } $output .= $link_before; $output .= $j; $output .= $link_after; if ( ($i != $page) || (empty($more) && ($page==1)) ) $output .= ''; else $output .= ''; } $output .= $after; } else { if ( $more ) { $output .= $before; $i = $page - 1; if ( $i && $more ) { $output .= ''; if ( 1 == $i ) { $output .= '' . $link_before. $previouspagelink . $link_after . ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= '' . $link_before. $previouspagelink . $link_after . ''; else $output .= '' . $link_before. $previouspagelink . $link_after . ''; } $output .= ''; } $i = $page + 1; if ( $i <= $numpages && $more ) { $output .= ''; if ( 1 == $i ) { $output .= '' . $link_before. $nextpagelink . $link_after . ''; } else { if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) $output .= '' . $link_before. $nextpagelink . $link_after . ''; else $output .= '' . $link_before. $nextpagelink . $link_after . ''; } $output .= ''; } $output .= $after; } } } if ( $echo ) echo $output; return $output; } ?>