Created
August 23, 2012 01:48
-
-
Save dimiro1/3431194 to your computer and use it in GitHub Desktop.
Album DietaJa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.galeria{position:relative;margin:10px 0px}.galeria .pika-stage{width:625px;min-height:455px;padding-top:133px}.galeria .pika-stage .pika-aniwrap{position:absolute;top:10px;left:10px;z-index:9;display:none}.galeria .caption{position:relative}.galeria .pika-thumbs li{width:189px;height:133px;cursor:pointer;float:left;list-style:none;overflow:hidden;margin:0px 1px}.galeria .pika-thumbs .clip{position:relative;width:189px;height:133px;overflow:hidden}.galeria .pika-stage{text-align:center}.galeria .pika-stage .caption{font:normal 12px Arial,sans-serif;font-style:italic;padding:10px 5px;color:#000;text-align:left;background:#dbd8ed;display:block;clear:both;margin-top:-3px}.galeria .pika-stage .caption a{color:black}.galeria .pika-imgnav a{position:absolute;top:0px;text-indent:-5000px;height:61px;width:42px;display:block;z-index:11;cursor:pointer}.galeria .pika-imgnav .next,.galeria .pika-imgnav .previous{top:154px}.galeria .pika-imgnav .previous{display:none}.galeria .pika-imgnav .next{display:none}.galeria .pika-imgnav .play{top:10px;display:none}.galeria .pika-imgnav .pause{top:10px;display:none}.galeria .pika-textnav{display:none}.galeria .pika-counter{display:none;position:absolute;top:-18px;left:10px;font:bold 15px arial;color:#57607A}.galeria .jcarousel-clip-horizontal{width:575px;overflow:hidden;left:24px;top:0px}.galeria .jcarousel-container{width:625px;height:133px;z-index:10;overflow:hidden;position:absolute !important;top:0px}.galeria .jcarousel-prev,.galeria .jcarousel-next{width:27px;height:133px;display:block;position:absolute;top:0px;cursor:pointer}.galeria .jcarousel-prev{background:url('../images/gallery-s9be88536ad.png') 0 -133px no-repeat;left:0px}.galeria .jcarousel-next{background:url('../images/gallery-s9be88536ad.png') 0 -399px no-repeat;right:0px}.galeria .jcarousel-prev:hover,.galeria .jcarousel-prev-disabled{background:url('../images/gallery-s9be88536ad.png') 0 0 no-repeat}.galeria .jcarousel-next:hover,.galeria .jcarousel-next-disabled{background:url('../images/gallery-s9be88536ad.png') 0 -266px no-repeat} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_shortcode('gallery', 'gallery_shortcode'); | |
add_shortcode('gallery', 'dietaja_gallery_shortcode'); | |
add_image_size('galeria', 625, 416, true); | |
function dietaja_gallery_shortcode($attr) | |
{ | |
global $post; | |
static $instance = 0; | |
$instance++; | |
// Allow plugins/themes to override the default gallery template. | |
$output = apply_filters('post_gallery', '', $attr); | |
if ($output != '') | |
return $output; | |
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement | |
if (isset($attr['orderby'])) { | |
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']); | |
if (!$attr['orderby']) | |
unset($attr['orderby']); | |
} | |
extract(shortcode_atts(array( | |
'order' => 'ASC', | |
'orderby' => 'menu_order ID', | |
'id' => $post->ID, | |
'columns' => 3, | |
'size' => 'galeria', | |
'include' => '', | |
'exclude' => '' | |
), $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 ''; | |
$output = ""; //apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div ); | |
$i = 1; | |
$random = rand(); | |
$output .= '<div id="gallery-' . $random . '" class="galeria">'; | |
$output .= '<ul>'; | |
foreach ($attachments as $id => $attachment): | |
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false); | |
$output .= "<li>$link<span>". $attachment->post_title ."</span></li>"; | |
endforeach; | |
$output .= '</ul>'; | |
$output .= '</div>'; | |
$output.= '<script type="text/javascript">$(".galeria ul").PikaChoose({carousel:true, thumbOpacity:0.4});</script>'; | |
$output .= '<br style="clear: both" />'; | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment