Advertisement
cbanowsky

Dynamic Slide Show.

Sep 1st, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.73 KB | None | 0 0
  1. <?php get_header();
  2.   error_reporting(0);
  3.     inf_update_posts_views(get_the_ID());
  4.  
  5.     the_post();
  6.  
  7.     if(is_user_logged_in()) {
  8.         $current_user_influencers = inf_get_influencers();
  9.     } ?>
  10.     <section id="content">
  11.         <div class="shell shop">
  12.             <?php $post_categories = wp_get_post_terms( get_the_ID(), 'category' );
  13.  
  14.             $args = array(
  15.                 'connected_type' => 'posts_to_influencers',
  16.                 'connected_items' => get_the_ID(),
  17.                 'nopaging' => true,
  18.                 'posts_per_page' => 1
  19.             );
  20.  
  21.             $influencer = get_posts($args);
  22.  
  23.  
  24.             //if(!empty($influencer)) {
  25.         ?>
  26.                 <div class="shop-main">
  27.                     <!--<div class="breadcrumbs"><a href="#">SHOP ></a> <?php //echo strtoupper(get_the_title()); ?></div> /.breadcrumbs -->
  28.           <div class="column-three" style="border: none;">
  29.           <div class="column adcolumn" style="">
  30.                 <a href="http://click.linksynergy.com/fs-bin/click?id=pwlaa2*cgnI&offerid=276224.10013359&subid=0&type=4">
  31.                   <img src="<?php bloginfo('stylesheet_directory'); ?>/images/nordstrom2.jpg" />
  32.                 </a>
  33.              </div>
  34.           <div class="left-col theme right">
  35.                         <?php if(has_post_thumbnail()) { ?>
  36.                             <?php
  37.                 $thisDESC = get_the_content();
  38.                 $thisURL = get_permalink();
  39.                 $img_obj = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
  40.                 inf_social_share($thisURL, $influencer_name, $img_obj[0], $thisDESC);
  41.                 $category_link = get_category_link($post_categories[0]->term_id);
  42.               ?>
  43.               <div class="inner" style="width: 430px; height:600px; margin-right:24px; background:#d6f7ee">
  44.                                 <ul class="slides"><?php } ?>
  45.                                 <li><a href="<?php echo $img_obj[1]; ?>" class="colorbox">
  46.                                     <?php the_post_thumbnail('inf_featured_theme', array('class' => 'inf_featured_theme')); ?>
  47.                                 </a></li>
  48.                 <?php inf_theme_slider_theme(); ?>
  49.                 </ul>
  50.                 <div class="shop-featured-prev">&nbsp;</div>
  51.                 <div class="shop-featured-next">&nbsp;</div>
  52.                             </div>
  53.               <!-- /.inner -->
  54.  
  55.               <!--<div class="shop-maintag"><a href="<?php echo $category_link; ?>"><?php echo strtoupper($post_categories[0]->name); ?></a></div> -->
  56.                         <?php //} ?>
  57.                     </div><!-- /.left-col -->
  58.                     <div class="right-col left" style="float: left; width:225px;">
  59.                         <?php
  60.  
  61.                         //$exact_items = carbon_get_the_post_meta('inf_influencer_products');
  62.             $products_sections = carbon_get_the_post_meta('inf_post_products_sections', 'complex');
  63.             global $wp;
  64.             $current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );
  65.             ?>
  66.             <div class="shop-main-theme">
  67.                 <div class="shop-main-title"><?php echo get_the_title(get_the_ID()); ?></div>
  68.                         <div class="text-holder" style="margin:0; padding:0; height:auto;">
  69.               <img class="shop-published-by1" style="display:block; margin:20px auto 30px;" src="<?php bloginfo('stylesheet_directory'); ?>/images/published-by-danielle.png" />
  70.               <!--<div class="shop-main-social"><a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo ($current_url) ?>&redirect_uri=<?php echo urlencode($current_url) ?>" class="facebook"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-facebook.png" /></a> <a href="https://instagram.com/theinfluence" class="instagram"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-instagram.png" /></a> <a href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode($current_url) ?>&media=<?php echo $img_obj[0]; ?>&description=<?php echo str_replace(" ", "+", get_the_title(get_the_ID())); ?>" class="pinterest"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/soc-pinterest.png" /></a></div> -->
  71.  
  72.               <?php //if(!empty($post_categories) || is_user_logged_in()) { ?>
  73.                             <?php
  74.                 the_content();
  75.                 //echo get_the_content();
  76.                 /*
  77.                 $content = get_the_content();
  78.                 $content = apply_filters($content);
  79.                 if (strlen($content) > 120) {
  80.                   $content = substr($content, 0, 120) . '...';
  81.                 }
  82.                 echo $content;
  83.                 */
  84.               ?>                      
  85.               </div>      
  86.                         </div><!-- /.text-holder -->
  87.                     </div><!-- /.right-col -->
  88.           </div><!-- /.column-three -->
  89.               </div>    <!-- /.shop-main -->
  90.         <div class="column-three bottom" style="margin-top: 120px;">
  91.             <img src="<?php bloginfo('stylesheet_directory'); ?>/images/shopthetrend.jpg" class="" style="margin:0 auto; display:block; margin-bottom:80px;" />
  92.                 <?php $products_sections = carbon_get_the_post_meta('inf_post_products_sections', 'complex');
  93.                 if(!empty($products_sections)) {
  94.                     foreach($products_sections as $key=>$ps) {
  95.               $products = $ps['products'];
  96.               if(!empty($products)) { ?>
  97.               <br /><br />
  98.                 <h2 class="prod-section"><?php echo $ps['section_name']; ?></h2>
  99.                 <div id="shop-slider-<?php echo $key+1; ?>" class="prod-row">
  100.                   <ul class="slides">
  101.                     <?php $index = 1;
  102.  
  103.                     foreach($products as $p) {
  104.  
  105.                       $post_obj = get_post($p);
  106.  
  107.                       if(!empty($post_obj)) {
  108.  
  109.                         $post_id = $post_obj->ID;
  110.                         $post_title = get_the_title($post_id);
  111.                         $shortTitle = $post_title;
  112.                         if (strlen($post_title) > 24) {
  113.                           $shortTitle = substr($shortTitle, 0, 24) . '...';
  114.                         }
  115.                        
  116.                         $product_designer = get_post_meta($post_id, 'designer', true);
  117.                         $shortDesigner = $product_designer;
  118.                         if (strlen($shortDesigner) > 24) {
  119.                           $shortDesigner = substr($shortDesigner, 0, 24) . '...';
  120.                         }
  121.                         $buy_link = get_post_meta($post_id, 'product_url', true);
  122.                         $product_price = get_post_meta($post_id, 'price', true); ?>
  123.                         <li>
  124.                           <?php //inf_social_share($buy_link, get_the_title($post_id), wp_get_attachment_thumb_url($post_id), get_the_title($post_id)); ?>
  125.                           <a href="<?php echo esc_url($buy_link); ?>" target="_blank" title="<?php echo $product_designer . ' -- ' . $post_title; ?>">
  126.                             <?php if(has_post_thumbnail($post_id)) { ?>
  127.                               <span class="img-hold">
  128.                                 <?php echo get_the_post_thumbnail($post_id, 'inf_single_product'); ?>
  129.                               </span>
  130.                             <?php } ?>
  131.                             <h5 style="font-weight: bold;"><?php echo $shortDesigner; ?></h5>
  132.                             <h5><?php echo $shortTitle; ?></h5>
  133.                             <?php if(!empty($product_price)) { ?>
  134.                               <h6>$<?php echo $product_price; ?></h6>
  135.                             <?php } ?>
  136.                           </a>
  137.                         </li>
  138.                         <?php  ?>
  139.                          
  140.                         <?php
  141.  
  142.                         $index++;
  143.  
  144.                       }
  145.  
  146.                     } ?>
  147.                   </ul>
  148.                     <div class="prev-<?php echo $key+1; ?>">&nbsp;</div><!-- /.prev -->
  149.                     <div class="next-<?php echo $key+1; ?>">&nbsp;</div><!-- /.next -->
  150.                 </div><!-- /.prod-row -->
  151.               <?php }
  152.             }
  153.  
  154.                 }
  155.       ?>
  156.         </div>
  157.        
  158.         <div class="ad_banner">
  159.         <a href="http://shop.theinfluence.com">
  160.           <img src="<?php bloginfo('stylesheet_directory'); ?>/images/shop-banner.gif" />
  161.         </a>
  162.           <!-- BEGIN IFRAME TAG - theinfluence 728x90 < - DO NOT MODIFY -->
  163.           <!--<IFRAME SRC="http://ib.adnxs.com/tt?id=2411079&cb=[CACHEBUSTER]&referrer=[REFERRER_URL]&pubclickenc=%5BINSERT_CLICK_TAG%5D" FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true" WIDTH="728" HEIGHT="90"></IFRAME>-->
  164.           <!-- END TAG -->
  165.         </div>
  166.       <?php
  167.  
  168.             //}
  169.  
  170.             // showing random ("related") below
  171.             $args = array(
  172.                 'post_type' => 'post',
  173.                 'orderby' => 'rand',
  174.                 'posts_per_page' => 5,
  175.                 'meta_query' => array(
  176.                     array(
  177.                         'key' => '_thumbnail_id',
  178.                         'value' => '',
  179.                         'compare' => '!='
  180.                     )
  181.                 )
  182.             );
  183.  
  184.             //$random = get_posts($args);
  185.  
  186.             if(!empty($random)) { ?>
  187.                 <div class="cols column-three morelike">
  188.           <h2>more like this</h2>
  189.                     <div class="row no-border">
  190.                         <?php foreach($random as $r) {
  191.  
  192.                             $args = array(
  193.                                 'connected_type' => 'posts_to_influencers',
  194.                                 'connected_items' => $r->ID,
  195.                                 'posts_per_page' => 1
  196.                             );
  197.  
  198.                             $influencer = get_posts($args);
  199.              
  200.               $thisTitle = get_the_title($r->ID);
  201.               if (strlen($thisTitle) > 40) {
  202.                 $thisTitle = substr($thisTitle, 0, 40) . '...';
  203.               }
  204.              
  205.               //echo get_the_title($influencer[0]->ID);
  206.  
  207.                             ?>
  208.                                 <div class="col_5">
  209.                                     <a href="<?php echo get_permalink($r->ID); ?>">
  210.                                         <div class="img-hold">
  211.                       <?php echo get_the_post_thumbnail($r->ID, 'inf_single_more_like'); ?>
  212.                       <div class="shop-link">SHOP</div>
  213.                     </div>
  214.                                         <p><?php echo $thisTitle; ?></p>
  215.                                     </a>
  216.                                 </div><!-- /.col_5 -->
  217.                             <?php
  218.  
  219.                         } ?>
  220.                     </div><!-- /.row -->
  221.                 </div><!-- /.cols -->
  222.             <?php } ?>
  223.         </div><!-- /.shell -->
  224.    
  225.    
  226.     </section><!-- /#content -->
  227.   <?php #inf_browse_by(); ?>
  228.  
  229.   <?php
  230.   ini_set('display_errors', 1);
  231.   // The interviews page displays the latest interview for now
  232.   $args = array(
  233.     'numberposts' => 3,
  234.     'orderby' => 'date',
  235.     'order' => 'DESC',
  236.     'post_type' => 'inf-interview',
  237.     'post_status' => 'publish'
  238.   );
  239.   $interviews = get_posts($args);
  240.   #print_r($interviews);
  241.  $key = 0;
  242.   ?>
  243.   <div class="more_interviews">
  244.     <div class="more_interviews_wrapper">
  245.     <?php foreach ($interviews as $_interview):
  246.         #print_r($_interview); die();
  247.         $image_id = get_post_thumbnail_id($_interview->ID);
  248.         $thumbnail = wp_get_attachment_image_src($image_id, 'medium');
  249.     ?>
  250.             <div class="more_int_block">
  251.                 <a href="<?php echo $_interview->post_link; ?>">
  252.                 <img src="<?php echo $thumbnail[0]; ?>" alt="<?php echo $_interview->post_title; ?>" width="100%" />
  253.                 <h3><?php echo $_interview->post_title; ?></h3>
  254.                 <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/btn_viewmore.jpg" />
  255.                 </a>
  256.             </div>
  257.     <?php
  258.     endforeach; ?>
  259.         </div>
  260.   </div>
  261. <?php get_footer(); ?>
  262.  
  263. <?php
  264. function inf_theme_slider_theme() {
  265.   global $post;
  266.   $images = carbon_get_post_meta($post->ID, 'inf_featured_image', 'complex');
  267.   foreach($images as $image) {
  268.     $image_full  = wp_get_attachment_image_src($image[inf_featured_image], 'full');
  269.     $image_small = wp_get_attachment_image_src($image[inf_featured_image], 'inf_featured_theme');
  270.     ?>
  271.     <li><a href="<?php echo $image_full[0]; ?>" class="colorbox">
  272.       <img src="<?php echo $image_small[0]; ?>" class="inf_single_image" />
  273.         </a></li>
  274.     <?php
  275.   }
  276. }
  277. ?>
  278.  
  279. <script>
  280. jQuery(window).load(function() {
  281.   //jQuery('.shop-main .inner.slides').flexslider();
  282.   jQuery('.shop-main .left-col .slides').carouFredSel({
  283.             prev: '.shop-featured-prev',
  284.             next: '.shop-featured-next',
  285.             items: 1,
  286.             auto: false
  287.   });
  288. });
  289. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement