'; echo ''; echo $connectflash; echo ''; echo ''; } $adwp_thumb_width = 55; $adwp_thumb_height = 55; $adwp_full_width = 748; $adwp_full_height = 360; $adwp_spacing = 10; add_theme_support( 'post-thumbnails' ); function print_adwp_styles () { $content .= ''."\n"; if (file_exists(get_stylesheet_directory().'/adwp.css')) { $content .= ''."\n"; } echo $content; } function print_adwp_scripts () { wp_enqueue_script('adwp', WP_PLUGIN_URL . '/ad-gallery/adwp.js', array('jquery')); } function yas_gallery ($atts, $content = null) { global $post; global $adwp_thumb_width; global $adwp_thumb_height; global $adwp_spacing; extract( shortcode_atts( array( 'post_id' => '', 'box_width' => '600', 'box_height' => '770', 'title' => 'Gallery', 'thumbnail' => false, 'thumb_class' => 'alignright', ), $atts ) ); $post_id = $post -> ID; $args = array( 'post_type' => 'attachment', 'numberposts' => -1, // bring them all 'exclude' => get_post_thumbnail_id( $post_id ), /* exclude the featured image */ 'orderby' => 'menu_order', 'order' => 'ASC', 'post_status' => null, 'post_parent' => $post_id /* post id with the gallery */ ); $slides = get_posts($args); $total_slides = count($slides); $strip_width = ($adwp_thumb_width + ($adwp_spacing * 2)) * $total_slides; /* get the full size img src */ $main_img = wp_get_attachment_image_src($slides[0]->ID, 'adwp_full'); $full_img = wp_get_attachment_image_src($slides[0]->ID, 'full'); $main_img_url = $main_img[0]; $full_img_url = $full_img[0]; $main_slide_caption = $slides[0] -> post_excerpt; /* Image caption */ $main_slide_alt = $slides[0] -> post_content; /* Image description */ $gallery = "\n\n
"; $gallery .= "
\n\"$main_slide_alt\"\n"; $gallery .= "
"; $gallery .= "

$main_slide_caption

\n"; $gallery .= "
"; $gallery .= "

\"previous\"

"; $gallery .= "
"; $gallery .= "
    "; $is_first = true; foreach ($slides as $slide) { $thumbnailObj = wp_get_attachment_image_src($slide->ID, 'adwp_thumb'); $thumbnailURL = $thumbnailObj[0]; $thumb_css_class = ($is_first)?'current':'reg'; $slide_title = $slide -> post_excerpt; $slide_alt = $slide -> post_content; $slideObj = wp_get_attachment_image_src($slide->ID, 'adwp_full'); $slideURL = $slideObj[0]; $fullObj = wp_get_attachment_image_src($slide->ID, 'full'); $fullURL = $fullObj[0]; $gallery .= '
  • '.$slide_alt.'
  • '.PHP_EOL; $is_first = false; } $gallery .= "
\n"; $gallery .= "
\n"; $css_visibility = (count($slides) > 10)?'visible':'hidden'; $gallery .= "

\"next\"

"; $gallery .= "
\n"; $gallery .= "
\n"; return $gallery; } if (!is_admin()) { add_action('wp_print_scripts', 'print_adwp_scripts'); add_action('wp_head', 'print_adwp_styles'); remove_shortcode('gallery'); add_shortcode('gallery', 'yas_gallery'); } add_image_size( 'adwp_thumb', $adwp_thumb_width, $adwp_thumb_height, true ); add_image_size( 'adwp_full', $adwp_full_width, $adwp_full_height, false ); ?>