Example #1
0
<h1 class="page-title"><a href="#"><?php 
the_title();
?>
</a></h1>		  
               <ul class="thumbnail">
          <?php 
if ($wp_query->have_posts()) {
    while (have_posts()) {
        the_post();
        the_content();
        $attachment_args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID, 'orderby' => 'menu_order ID');
        $attachments = get_posts($attachment_args);
        if ($attachments) {
            foreach ($attachments as $gallery_image) {
                $attachment_img = wp_get_attachment_url($gallery_image->ID);
                $img_source = inkthemes_image_resize($attachment_img, 208, 140);
                echo ' <div class="gallery_entry">
									<div class="item_image"><li><a alt="' . $gallery_image->post_title . '" href="' . $attachment_img . '" rel="prettyPhoto[gallery2]"> <span class="overlay">';
                echo '<img class="portfolio" src="' . $img_source[url] . '" alt=""$img_source[url]"/>';
                echo '</div></div></li></a></span>';
            }
        }
        ?>
            <?php 
    }
}
?>
    </ul>  
        </div>
        </div>
		</div>
Example #2
0
function inkthemes_gallery_shortcode($attr)
{
    $post = get_post();
    static $instance = 0;
    $instance++;
    if (!empty($attr['ids'])) {
        // 'ids' is explicitly ordered, unless you specify otherwise.
        if (empty($attr['orderby'])) {
            $attr['orderby'] = 'post__in';
        }
        $attr['include'] = $attr['ids'];
    }
    // 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, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => ''), $attr));
    $id = intval($id);
    if ('RAND' == $order) {
        $orderby = 'none';
    }
    if (!empty($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)) {
        $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 '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= wp_get_attachment_link($att_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}";
    ?>
        <script>
            //Gallery
            //Prety Photo	  
            jQuery.noConflict();
            jQuery(document).ready(function () {
                jQuery(".<?php 
    echo $selector;
    ?>
 a[rel^='prettyPhoto']").prettyPhoto({animation_speed: 'normal', theme: 'light_square', slideshow: 8000, autoplay_slideshow: true});
            });
        </script>
        <?php 
    $gallery_style = $gallery_div = '';
    if (apply_filters('use_default_gallery_style', true)) {
        $gallery_style = "\n\t\t<style type='text/css'>\n\t\t\t#{$selector} {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#{$selector} .gallery-item {\n\t\t\t\tfloat: {$float};\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: {$itemwidth}%;\n\t\t\t}\n\t\t\t#{$selector} img {\n\t\t\t}\n\t\t\t#{$selector} .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t</style>\n\t\t<!-- see gallery_shortcode() in wp-includes/media.php -->";
    }
    $size_class = sanitize_html_class($size);
    $gallery_div = "<div id='{$selector}' class='{$selector} gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
    $gallery_ul = "<ul class='thumbnail col-{$columns}'>";
    $output = apply_filters('gallery_style', $gallery_style . "\n\t\t" . $gallery_div . $gallery_ul);
    $i = 0;
    foreach ($attachments as $gallery_image) {
        $attachment_img = wp_get_attachment_url($gallery_image->ID);
        $img_source = inkthemes_image_resize($attachment_img, 350, 245);
        $output .= "<li class='animated'>";
        $output .= '<a rel="prettyPhoto[gallery2]" alt="' . $gallery_image->post_excerpt . '" href="' . $attachment_img . '">';
        $output .= '<span>';
        $output .= '</span>';
        $output .= '<img src="' . $img_source['url'] . '" alt=""/>';
        $output .= '</a>';
        if (isset($gallery_image->post_excerpt) && $gallery_image->post_excerpt != '') {
            $output .= '<h2><a class="gall-content"  href="?attachment_id=' . $gallery_image->ID . '">';
            $output .= $gallery_image->post_excerpt;
            $output .= '</a></h2>';
        }
        $output .= "</li>";
    }
    $output .= "\n\t<br style='clear: both;' />\t\t\t\n\t</ul>\n\n\t</div>";
    return $output;
}
/**
 * This function gets image width and height and
 * Prints attached images from the post        
 */
function inkthemes_get_image($width, $height)
{
    $w = $width;
    $h = $height;
    global $post, $posts;
    //This is required to set to Null
    $img_source = '';
    $permalink = get_permalink($id);
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    if (isset($matches[1][0])) {
        $img_source = $matches[1][0];
    }
    $img_path = inkthemes_image_resize($img_source, $w, $h);
    if (!empty($img_path[url])) {
        print "<a href='{$permalink}'><img src='{$img_path['url']}' class='postimg' alt='Post Image'/></a>";
    }
}
        the_post();
        the_content();
    }
}
?>
            <ul class="thumbnail">
                <?php 
if ($wp_query->have_posts()) {
    while (have_posts()) {
        the_post();
        $attachment_args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID, 'orderby' => 'menu_order ID');
        $attachments = get_posts($attachment_args);
        if ($attachments) {
            foreach ($attachments as $gallery_image) {
                $attachment_img = wp_get_attachment_url($gallery_image->ID);
                $img_source = inkthemes_image_resize($attachment_img, 266, 158);
                echo '<li><a alt="' . $gallery_image->post_title . '" href="' . $attachment_img . '" class="zoombox zgallery1">';
                echo '<div class="img_thumb_gallery"><span></span><img src="' . $img_source['url'] . '" alt=""/>';
                echo '</div></a></li>';
            }
        }
    }
}
?>
            </ul>
        </div>
        <div class="clear"></div>
        <div class="folio-page-info">
            <?php 
pagination();
?>