Advertisement
Guest User

Untitled

a guest
Jul 21st, 2013
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.00 KB | None | 0 0
  1. <?php if (of_get_option("cap_show_merch") == true){?>
  2.         <?php //woocommerce check ?>
  3.         <?php if (  in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { ?>
  4.             <h2><?php echo of_get_option("cap_merch_title"); ?></h2>
  5.             <div class="preview-block">
  6.                 <?php
  7.                 global $product;
  8.                 $num = 0;
  9.                 $merch = new WP_Query( array(
  10.                 'posts_per_page' => 5,
  11.                 'post_type'      => array( 'product' ),
  12.                                 'post_status' => 'publish'
  13.                 ) );
  14.  
  15.                 if( $merch->have_posts() ) : while( $merch->have_posts() ) : $merch->the_post();
  16.                     $product = get_product();
  17.  
  18.                     if ( $num == 0 ) : ?>
  19.                         <div class="preview">
  20.                             <div class="visual">
  21.                                 <?php if ( has_post_thumbnail() ) : ?>
  22.                                     <img src="<?php echo aq_resize( wp_get_attachment_url( get_post_thumbnail_id(), 'full' ), 473, 453, true );  ?>" width="473" height="453" alt="<?php the_title(); ?>" />
  23.                                 <?php else : ?>
  24.                                     <img src="<?php echo woocommerce_placeholder_img_src(); ?>" alt="Placeholder" />
  25.                                 <?php endif; ?>
  26.                                 <a href="<?php the_permalink(); ?>" class="mask"></a>
  27.                                 <?php woocommerce_template_loop_price(); ?>
  28.                             </div>
  29.                             <a href="<?php the_permalink(); ?>" class="caption"><?php the_title(); ?></a>
  30.                         </div>
  31.                     <?php else : ?>
  32.                         <?php if ( $num == 1 ) : ?>
  33.                             <ul class="catalog">
  34.                         <?php endif; ?>
  35.                         <li>
  36.                             <div class="visual">
  37.                                 <?php if ( has_post_thumbnail() ) : ?>
  38.                                     <img src="<?php echo aq_resize( wp_get_attachment_url( get_post_thumbnail_id(), 'full' ), 222, 193, true );  ?>" width="222" height="193" alt="<?php the_title(); ?>" />
  39.                                 <?php else : ?>
  40.                                     <img src="<?php echo woocommerce_placeholder_img_src(); ?>" alt="Placeholder" />
  41.                                 <?php endif; ?>
  42.                                 <a href="<?php the_permalink(); ?>" class="mask"></a>
  43.                                 <?php woocommerce_template_loop_price(); ?>
  44.                             </div>
  45.                             <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  46.                         </li>
  47.                         <?php
  48.                     endif;
  49.                     $num++;
  50.                 endwhile;
  51.                 ?>
  52.                 </ul>
  53.                 <?php endif; wp_reset_postdata(); ?>
  54.             </div><!--preview-block-->
  55.         <?php } //woocommerce check?>
  56.     <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement