wpexplorer

PhotoPro Attachments Template

Aug 27th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: PhotoPro Attachments Template
  4. *
  5. *
  6. * This template file contains the the default homepage structure for this theme
  7. * @package PhotoPro WordPress Theme
  8. * @since 1.0
  9. * @author AJ Clarke : http://wpexplorer.com
  10. * @copyright Copyright (c) 2012, AJ Clarke
  11. * @link http://wpexplorer.com
  12. * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  13. */
  14.  
  15. get_header(); // Loads the header.php template ?>
  16.  
  17. <div id="home-wrap" class="clearfix">
  18. <?php
  19. // Get theme options
  20. global $data;
  21. // Load Isotope Scripts
  22. wpex_load_isotope_scripts(); ?>
  23. <?php
  24. if ( $data['lightbox_style'] == 'fancybox' ) {
  25. wp_enqueue_style( 'fancybox', WPEX_CSS_DIR . '/fancybox.css' );
  26. wp_enqueue_script('fancybox', WPEX_JS_DIR .'/fancybox.js', array('jquery'), '2.1.3', true);
  27. wp_enqueue_script('wpex-fancybox-init', WPEX_JS_DIR .'/fancybox-init.js', array('jquery'), '1.0', true);
  28. } ?>
  29. <div id="galleries-wrap">
  30. <div id="masonry-wrap">
  31. <?php
  32. $attachments = get_posts( array(
  33. 'post_type' => 'attachment',
  34. 'posts_per_page' => -1,
  35. 'post_parent' => null, // any parent
  36. ) );
  37. if ( $attachments ) { ?>
  38. <?php foreach ( $attachments as $attachment ) : ?>
  39. <article class="masonry-entry">
  40. <?php
  41. // Get resize and show featured image : refer to functions/img_defaults.php for default values
  42. $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' ) );
  43. if($wpex_gallery_entry_img) { ?>
  44. <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>
  45. <?php } ?>
  46. </article><!-- /masonry-entry -->
  47. <?php endforeach; ?>
  48. <?php } ?>
  49. </div><!-- /masonry-wrap -->
  50. </div><!-- /galleries-wrap -->
  51. <div id="masonry-pagination">
  52. <?php wp_reset_postdata(); ?>
  53. </div><!-- /masonry-pagination -->
  54.  
  55. </div><!-- /home-wrap -->
  56.  
  57. <?php get_footer(); // Loads the footer.php file ?>
Advertisement
Add Comment
Please, Sign In to add comment