PageRenderTime 40ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/medicale-wp-main-files/medicale-wp/mascot-framework/core/custom-post-types/portfolio/shortcodes/tpl/portfolio-grid.php

https://bitbucket.org/dripolab/diprolab
PHP | 102 lines | 91 code | 7 blank | 4 comment | 25 complexity | f2198d04e93532c2cfdd1088206ba659 MD5 | raw file
Possible License(s): MIT, Apache-2.0, GPL-3.0
  1. <?php if ( $the_query->have_posts() ) : ?>
  2. <?php if ( $show_portfolio_filter == 'true' ) : ?>
  3. <?php
  4. $portfolio_filters = array();
  5. while ( $the_query->have_posts() ) :
  6. $the_query->the_post();
  7. //Returns All Term Items for $ptTaxKey
  8. $term_list = wp_get_post_terms(get_the_ID(), $ptTaxKey, array("fields" => "all"));
  9. if ( !empty ( $term_list) ) {
  10. foreach($term_list as $term) {
  11. $portfolio_filters[$term->slug] = $term->name;
  12. }
  13. }
  14. endwhile;
  15. wp_reset_postdata();
  16. $portfolio_filters = array_unique($portfolio_filters);
  17. ?>
  18. <!-- Portfolio Filter -->
  19. <div class="gallery-isotope-filter style-boxed" data-link-with="<?php echo $holder_id ?>">
  20. <a href="#" class="active" data-filter="*">All</a>
  21. <?php if ( !empty($portfolio_filters) ) { foreach ( $portfolio_filters as $slug=>$name ) { ?>
  22. <a href="#<?php echo $slug;?>" class="" data-filter=".<?php echo $slug;?>"><?php echo $name;?></a>
  23. <?php } } ?>
  24. </div>
  25. <!-- End Portfolio Filter -->
  26. <?php endif; ?>
  27. <!-- Portfolio Grid -->
  28. <div id="<?php echo $holder_id ?>" class="gallery-isotope grid-<?php echo $columns;?> <?php echo $gutter;?> clearfix <?php echo $custom_css_class;?>">
  29. <!-- the loop -->
  30. <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  31. <?php
  32. $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
  33. $full_image_url = $full_image_url[0];
  34. $portfolio_images = rwmb_meta( 'medicale_mascot_' . "portfolio_metabox_portfolio_gallery_images", 'size=full' );
  35. //if has no post thumbnail
  36. if( !has_post_thumbnail( get_the_ID() ) ) {
  37. if ( !empty( $portfolio_images ) ) {
  38. $first_image_key = key($portfolio_images);
  39. echo $full_image_url = $portfolio_images[$first_image_key]['url'];
  40. }
  41. }
  42. //create resized image
  43. $resized_image = medicale_mascot_matthewruddy_image_resize( $full_image_url, $image_dimension['width'], $image_dimension['height'], true );
  44. // if has no post thubnail or portfolio images then add placeholder image
  45. if( !is_array( $resized_image ) || !$resized_image['url'] || $resized_image['url'] == '' ) {
  46. $resized_image = array();
  47. $full_image_url = $resized_image['url'] = "http://placehold.it/".$image_dimension['width']."x".$image_dimension['height']."?text=Image Not Found!";
  48. }
  49. $term_slugs_list = wp_get_post_terms( get_the_ID(), $ptTaxKey, array("fields" => "slugs") );
  50. $term_slugs_list_string = implode( $term_slugs_list, ' ' );
  51. $term_names_list = wp_get_post_terms( get_the_ID(), $ptTaxKey, array("fields" => "names") );
  52. $term_names_list_string = implode( $term_names_list, ', ' );
  53. ?>
  54. <!-- Portfolio Item Start -->
  55. <div class="gallery-item box-hover-effect <?php echo $portfolio_hover_effect;?> <?php echo $term_slugs_list_string;?>">
  56. <div class="effect-wrapper">
  57. <div class="thumb <?php echo ( $show_gradient_effect_on_image == 'true' ) ? 'gradient-effect' : '';?>">
  58. <img src="<?php echo $resized_image['url'];?>" alt="<?php the_title();?>" width="<?php echo $image_dimension['width'];?>">
  59. </div>
  60. <div class="overlay-shade <?php echo $portfolio_overlay_color_on_image;?>"></div>
  61. <div class="text-holder">
  62. <?php if ( $show_portfolio_title == 'true' ) : ?>
  63. <div class="title"><?php the_title();?></div>
  64. <?php endif; ?>
  65. <?php if ( $show_portfolio_description == 'true' ) : ?>
  66. <div class="description"><?php the_excerpt();?></div>
  67. <?php endif; ?>
  68. <?php if ( $show_selected_category == 'true' ) : ?>
  69. <div class="category"><?php echo $term_names_list_string;?></div>
  70. <?php endif; ?>
  71. <?php if ( $show_portfolio_date == 'true' ) : ?>
  72. <div class="date"><?php echo get_the_date(); ?></div>
  73. <?php endif; ?>
  74. </div>
  75. <?php if ( $show_portfolio_overlay_zoomlink_icons == 'true' ) : ?>
  76. <div class="icons-holder icons-holder-middle">
  77. <div class="icons-holder-inner">
  78. <div class="styled-icons icon-sm icon-dark icon-circled icon-theme-colored">
  79. <a title="<?php the_title();?>" href="<?php the_permalink();?>"><i class="fa fa-link"></i></a>
  80. </div>
  81. </div>
  82. </div>
  83. <?php endif; ?>
  84. <a title="<?php the_title();?>" href="<?php the_permalink();?>" class="hover-link"></a>
  85. </div>
  86. </div>
  87. <!-- Portfolio Item End -->
  88. <?php endwhile; ?>
  89. <!-- end of the loop -->
  90. </div>
  91. <!-- End Portfolio Grid -->
  92. <?php wp_reset_postdata(); ?>
  93. <?php else : ?>
  94. <p><?php esc_html_e( 'Sorry, no posts matched your criteria.', 'medicale-wp' ); ?></p>
  95. <?php endif; ?>