getPostTypeGallery

The Responsive Minimal getPostTypeGallery function.

Description

getPostTypeGallery( $atts, (constant) $content = null ); 

Parameters (2)

0. $atts
The atts.
1. $content — Optional. (constant) => null
The content.

Usage

  1. if ( !function_exists( 'getPostTypeGallery' ) ) { 
  2. require_once '/functions/shortcodes.php'; 
  3.  
  4. // The atts. 
  5. $atts = null; 
  6.  
  7. // The content. 
  8. $content = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = getPostTypeGallery($atts, $content); 
  12.  

Defined (1)

The function is defined in the following location(s).

/functions/shortcodes.php  
  1. function getPostTypeGallery($atts, $content = null) { 
  2. global $post, $wpdb; 
  3. extract( shortcode_atts( array( 
  4. 'taxonomy' => '',  
  5. 'wptg_post_type' => 'gallery',  
  6. 'style'=>"shadow" 
  7. ), $atts ) ); 
  8.  
  9. $multitask = '<style>@import url('.get_template_directory_uri().'/css/taxonomies-extended.css);</style>'; 
  10. if($wptg_post_type=='gallery') { 
  11. $multitask .= '<script> 
  12. jQuery(document).ready(function() { 
  13. jQuery(".taxonomy_item a.popup").colorbox(); 
  14. }); 
  15. </script> 
  16. '; 
  17.  
  18. if($taxonomy == '') { 
  19. $multitask .= '<script> 
  20. jQuery(document).ready(function() { 
  21. jQuery(\'#filters a\').click(function() { 
  22. var selector = jQuery(this).attr(\'data-filter\'); 
  23. jQuery(\'.taxonomy_filter\').isotope({ filter: selector }); 
  24. jQuery(\'.taxonomy_item a.popup\').attr(\'rel\', \'all_items\'); 
  25. jQuery(\'.taxonomy_item.isotope-hidden a.popup\').attr(\'rel\', \'\'); 
  26. return false; 
  27. }); 
  28. jQuery(\'#options\').find(\'.info_filters a\').click(function() { 
  29. var $this = jQuery(this); 
  30. if ( !$this.hasClass(\'sel_item\') ) { 
  31. $this.parents(\'.info_filters\').find(\'.sel_item\').removeClass(\'sel_item\');  
  32. $this.addClass(\'sel_item\'); 
  33. }); 
  34. jQuery(document).ready(function(e) { 
  35. jQuery(\'.taxonomy_filter\').isotope({ 
  36. itemSelector : \'.taxonomy_item\' 
  37. }); 
  38. }); 
  39. }); 
  40. </script>'; 
  41.  
  42. switch($wptg_post_type) { 
  43. case 'gallery': 
  44. $taxo = 'galleries'; $post_type = 'wtsgallery'; 
  45. break; 
  46. case 'services': 
  47. $taxo = 'brochures'; $post_type = 'wtsservice'; 
  48. break; 
  49. case 'portfolio': 
  50. $taxo = 'portfolios'; $post_type = 'wtsportfolio'; 
  51. break; 
  52.  
  53. $results = get_terms($taxo); 
  54. ob_start(); 
  55. if($taxonomy == '') {?> 
  56. <div id="options"> 
  57. <ul id="filters" class="info_filters"> 
  58. <?php if(count($results) > 1) { ?> 
  59. <li> 
  60. <h4><a href="filter" data-filter="*" class="sel_item"><?php echo __('All', 'tstranslate');?></a></h4> 
  61. </li> 
  62. <?php  
  63. $results = get_terms($taxo, 'order=DESC'); 
  64. foreach ($results as $result) { 
  65. echo '<li><h4><a href="#filter" data-filter=".'.$result->slug.'">'.$result->name.'</a></h4></li>'; 
  66. ?> 
  67. </ul> 
  68. </div> 
  69. <?php }?> 
  70. <div class="taxonomy_filter"> 
  71. <?php 
  72. if ($results) { 
  73.  
  74. query_posts(array('post_type'=>$post_type, $taxo=>$taxonomy, 'showposts' => -1)); 
  75. if (have_posts()): while ( have_posts() ): the_post();{ 
  76. $term_slugs = wp_get_post_terms($post->ID, $taxo, array("fields" => "slugs")); 
  77. $cats = implode(" ", $term_slugs); 
  78.  
  79. switch($wptg_post_type) { 
  80. case 'gallery': 
  81. $linkAttr = array('href'=> 'global', 'class'=> 'class="popup"', 'rel'=>'rel="all_items"'); 
  82. break; 
  83. case 'services': 
  84. case 'portfolio': 
  85. $linkAttr = array('href'=> get_permalink( $id ), 'class'=> '', 'rel'=>''); 
  86. break; 
  87. }?> 
  88. <div class="taxonomy_item <?php echo $cats?>"> 
  89. <h2><?php the_title();?></h2> 
  90. <?php postype_options($post->ID);?> 
  91. <div class='container_img_gallery boxcss_<?php echo ($style==0)?'shadow':$style;?>'> 
  92. <div class='container_hover_shine'> 
  93. <a href="<?php echo($linkAttr['href']!=='global')?$linkAttr['href']:$GLOBALS['post_type_options']['full'];?>" <?php echo $linkAttr['class']?> title="<?php echo $GLOBALS['post_type_options']['caption_img'];?>" <?php echo $linkAttr['rel']?>><?php the_post_thumbnail();?> 
  94. <div class="hover_shine"></div> 
  95. </a><!-- end middle center --> 
  96. </div><!-- end middle center --> 
  97. </div><!-- end container_img_gallery --> 
  98. </div><!-- end taxonomy_item --> 
  99.  
  100. <?php } endwhile; endif; wp_reset_query();} 
  101. $multitask .= '<div class="getPostTypeGallery">'.ob_get_clean(); 
  102. $multitask .= '</div><!-- end taxonomy_filter -->'; 
  103. $multitask .= '<div class="clear"></div></div><!-- end getPostTypeGallery container -->'; 
  104. return $multitask;