Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: PhotoPro Attachments Template
- *
- *
- * This template file contains the the default homepage structure for this theme
- * @package PhotoPro WordPress Theme
- * @since 1.0
- * @author AJ Clarke : http://wpexplorer.com
- * @copyright Copyright (c) 2012, AJ Clarke
- * @link http://wpexplorer.com
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- */
- get_header(); // Loads the header.php template ?>
- <div id="home-wrap" class="clearfix">
- <?php
- // Get theme options
- global $data;
- // Load Isotope Scripts
- wpex_load_isotope_scripts(); ?>
- <?php
- if ( $data['lightbox_style'] == 'fancybox' ) {
- wp_enqueue_style( 'fancybox', WPEX_CSS_DIR . '/fancybox.css' );
- wp_enqueue_script('fancybox', WPEX_JS_DIR .'/fancybox.js', array('jquery'), '2.1.3', true);
- wp_enqueue_script('wpex-fancybox-init', WPEX_JS_DIR .'/fancybox-init.js', array('jquery'), '1.0', true);
- } ?>
- <div id="galleries-wrap">
- <div id="masonry-wrap">
- <?php
- $attachments = get_posts( array(
- 'post_type' => 'attachment',
- 'posts_per_page' => -1,
- 'post_parent' => null, // any parent
- ) );
- if ( $attachments ) { ?>
- <?php foreach ( $attachments as $attachment ) : ?>
- <article class="masonry-entry">
- <?php
- // Get resize and show featured image : refer to functions/img_defaults.php for default values
- $wpex_gallery_entry_img = aq_resize( wp_get_attachment_url( $attachment->ID ), wpex_img( 'masonry_entry_width' ), wpex_img( 'masonry_entry_height' ), wpex_img( 'masonry_entry_crop' ) );
- if($wpex_gallery_entry_img) { ?>
- <a href="<?php echo wp_get_attachment_url( $attachment->ID ); ?>" class="view" rel="gallery" title="<?php echo $attachment->post_title; ?>"><img src="<?php echo $wpex_gallery_entry_img; ?>" alt="<?php echo $attachment->post_title; ?>" /></a>
- <?php } ?>
- </article><!-- /masonry-entry -->
- <?php endforeach; ?>
- <?php } ?>
- </div><!-- /masonry-wrap -->
- </div><!-- /galleries-wrap -->
- <div id="masonry-pagination">
- <?php wp_reset_postdata(); ?>
- </div><!-- /masonry-pagination -->
- </div><!-- /home-wrap -->
- <?php get_footer(); // Loads the footer.php file ?>
Advertisement
Add Comment
Please, Sign In to add comment