Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. <div id="portfolio-item" class="portfolio-item">
  2. <?php query_posts('post_type=portfolio' ); if(have_posts()) : while(have_posts()) : the_post();
  3.  
  4. $terms = wp_get_post_terms(get_the_ID(), 'portfolio-category', true );
  5. $t = $trm_name = array();
  6. foreach($terms as $term)
  7. $t[] = $term->slug;
  8. $trm_name[] = $term->name;
  9.  
  10. $galleries = get_post_meta( get_the_ID(), '_portfolio_settings', true );
  11. $images = $galleries['upload_gallery'];
  12. $ids = explode( ',', $images );
  13.  
  14. foreach ( $ids as $id ) {
  15. $attachment = wp_get_attachment_image_src( $id, 'full' );
  16. $image_url = wp_get_attachment_link(
  17. $image_url->ID, '' , true, false, 'Link to image attachment'
  18. );
  19. $item_meta = wp_prepare_attachment_for_js($id);
  20.  
  21. $img_caption = '';
  22. if ( ! empty( $item_meta['caption'] ) ) {
  23. $img_caption .= $item_meta['caption'];
  24. } else {
  25. $img_caption .= $item_meta['title'];
  26. }
  27.  
  28. ?>
  29.  
  30. <div class="item <?php echo implode(' ', $t); ?>">
  31. <figure>
  32. <img src="<?php echo $attachment[0] ; ?>" alt="Item 3">
  33. <div class="item-link">
  34. <a href="<?php echo $image_url[0]; ?>" title="Deneme"> </a>
  35. </div><!-- /.item-link -->
  36. <figcaption class="item-description">
  37. <h4 class="item-title">
  38. <?php echo esc_html($img_caption ); ?>
  39. </h4><!-- /.item-title -->
  40. <span class="item-category">
  41. <?php echo implode(', ', $trm_name); ?>
  42. </span><!-- /.item-category -->
  43. <span class="item-like-icon">
  44. <i class="fa fa-heart-o"></i> 26
  45. </span>
  46. </figcaption>
  47. </figure>
  48. </div><!-- /.item -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement