Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. <?php
  2. $postmeta = get_post_custom(get_the_id());  
  3. $attachments = array();
  4. if(!empty($postmeta["_format_gallery"][0])){                   
  5.     $attachments =  $postmeta["_format_gallery"][0];
  6.     $attachments = preg_replace('/[^0-9.]+/', ',', $attachments);
  7.     $attachments = explode(',',$attachments);
  8. }
  9. if ($attachments) {    
  10. ?>
  11. <div class="category-slider" value="slider-category-<?php echo esc_attr($post->ID) ?>">
  12.     <div id="slider-category" class="slider-category">
  13.         <ul id="slider" class="slider-category-<?php echo esc_attr($post->ID) ?>">
  14.             <?php foreach ($attachments as  $image_url) {
  15.                 $image_url = wp_get_attachment_url( $image_url );
  16.                 if(!empty($image_url)) { ?>
  17.                     <li>
  18.                         <img src="<?php echo esc_url( $image_url) ?>" />   
  19.                     </li>
  20.                 <?php } ?>
  21.             <?php } ?>
  22.         </ul>
  23.         <div class="bx-controls bx-has-pager bx-has-controls-direction">
  24.             <div class="bx-pager bx-custom-pager">
  25.                 <?php
  26.                 foreach ($attachments as  $key=>$image_url) {
  27.                     $image_url = wp_get_attachment_url( $image_url );
  28.                     if(!empty($image_url)) {
  29.                     ?> 
  30.                         <div class="bx-pager-item">
  31.                         <a data-slide-index="<?php echo esc_attr($key-1) ?>" href=""><img src="<?php echo esc_url( $image_url) ?>" alt="<?php ?>"/></a>
  32.                         </div>
  33.                     <?php } ?>
  34.                     <?php
  35.                 } ?>   
  36.             </div>
  37.         </div>
  38.     </div>
  39.     <?php
  40.     echo do_shortcode('[gallery size="medium" id="9094"]');?>
  41. </div>
  42. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement