Advertisement
Guest User

Dynamic Featured Image Usage

a guest
Nov 27th, 2013
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.74 KB | None | 0 0
  1. <?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
  2. <?php get_header(); ?>
  3. <?php if (have_posts()) : while (have_posts()) : the_post();
  4. // <!--/ START // DYNAMIC FEATURED IMAGE AWESOME PLUGIN -->    
  5.    if( function_exists('dfi_get_featured_images') ) {
  6.        $featuredImages = dfi_get_featured_images();
  7.        var_dump( $featuredImages );
  8.        //Now, loop through the image to display
  9.    }
  10.    
  11.    endwhile;
  12. ?>
  13.  
  14.         <article id="post-<?php the_ID(); ?>" <?php post_class("entry clearfix"); ?>>
  15.  
  16.             <?php
  17.             $post_pod_type = get_post_meta($post->ID, 'post_pod_type', true);
  18.             $post_type_values = get_post_meta($post->ID, 'post_type_values', true);
  19.             //***
  20.             switch ($post_pod_type) {
  21.                 case 'audio':
  22.                     echo do_shortcode('[audio]' . $post_type_values[$post_pod_type] . '[/audio]');
  23.                     break;
  24.                 case 'video':
  25.                     ?>
  26.  
  27.                     <?php
  28.                     $video_width = 700;
  29.                     $video_height = 300;
  30.  
  31.                     $source_url = $post_type_values[$post_pod_type];
  32.                     if (!empty($source_url)) {
  33.  
  34.                         $video_type = 'youtube.com';
  35.                         $allows_array = array('youtube.com', 'vimeo.com');
  36.  
  37.                         foreach ($allows_array as $key => $needle) {
  38.                             $count = strpos($source_url, $needle);
  39.                             if ($count !== FALSE) {
  40.                                 $video_type = $allows_array[$key];
  41.                             }
  42.                         }
  43.  
  44.                         switch ($video_type) {
  45.                             case $allows_array[0]:
  46.                                 echo do_shortcode('[video type="youtube" width="' . $video_width . '" height="' . $video_height . '"]' . $source_url . '[/video]');
  47.                                 break;
  48.                             case $allows_array[1]:
  49.                                 echo do_shortcode('[video type="vimeo" width="' . $video_width . '" height="' . $video_height . '"]' . $source_url . '[/video]');
  50.                                 break;
  51.                             default:
  52.                                 break;
  53.                         }
  54.                     }
  55.                     ?>
  56.  
  57.                     <?php
  58.                     break;
  59.  
  60.                 case 'quote':
  61.                     echo do_shortcode('[blockquote]' . $post_type_values[$post_pod_type] . '[/blockquote]');
  62.                     break;
  63.  
  64.                 case 'gallery':
  65.                     TMM_OptionsHelper::enqueue_script('cycle');
  66.                     $gall = $post_type_values[$post_pod_type];
  67.                     ?>
  68.  
  69.                     <?php if (!empty($gall)) : ?>
  70.  
  71.                         <div class="image-post-slider">
  72.                             <ul>
  73.                                 <?php foreach ($gall as $key => $source_url): ?>
  74.                                     <li><div class="preloader"><a rel="lightbox" href="<?php echo $source_url; ?>" class="bwWrapper single-image plus-icon"><img src="<?php echo TMM_Helper::resize_image($source_url, '700*300') ?>" alt="<?php echo $post->post_title ?>" /></a></div></li>
  75.                                 <?php endforeach; ?>
  76.                             </ul>
  77.                         </div><!--/ .image-post-slider-->
  78.  
  79.                     <?php endif; ?>
  80.                     <?php
  81.                     break;
  82.  
  83.                 default:
  84.                     ?>
  85.                     <?php if (has_post_thumbnail()) : ?>
  86.  
  87.                         <div class="entry-thumb">
  88.                             <div class="preloader"><a class="single-image plus-icon bwWrapper" href="<?php echo TMM_Helper::get_post_featured_image($post->ID, ''); ?>"><img src="<?php echo TMM_Helper::get_post_featured_image($post->ID, '700*300'); ?>" alt="<?php the_title(); ?>" /></a></div>
  89.                         </div>
  90.  
  91.                     <?php endif; ?>
  92.                     <?php
  93.                     break;
  94.             }
  95.             ?>
  96.  
  97.             <div class="entry-title">
  98.                 <h2 class="title"><?php the_title(); ?></h2>
  99.             </div><!--/ .entry-title-->
  100.  
  101.             <?php if (TMM::get_option("blog_single_show_all_metadata")) : ?>
  102.  
  103.                 <div class="entry-meta">
  104.  
  105.                     <?php if (TMM::get_option("blog_single_show_date")) : ?>
  106.                         <span class="date"><a href="<?php echo home_url() ?>/<?php echo get_the_date('Y/m') ?>"><?php echo get_the_date() ?></a></span>
  107.                     <?php endif; ?>
  108.  
  109.                     <?php if (TMM::get_option("blog_single_show_author")) : ?>
  110.                         <span class="author"><?php _e('By', TMM_THEME_FOLDER_NAME); ?>&nbsp;<?php the_author_link() ?></span>
  111.                     <?php endif; ?>
  112.  
  113.                     <?php $tags = get_the_tag_list('', ', '); ?>
  114.                     <?php if (TMM::get_option("blog_single_show_tags") AND !empty($tags)) : ?>                     
  115.                         <span class="tag"><?php echo $tags ?></span>
  116.                     <?php endif; ?>
  117.  
  118.                     <?php if (TMM::get_option("blog_single_show_category")) : ?>
  119.                         <?php $categories_list = get_the_category_list(__(', ', TMM_THEME_FOLDER_NAME)); ?>
  120.                         <?php if (!empty($categories_list)) : ?>
  121.                             <span class="categories">
  122.                                 <?php _e('In', TMM_THEME_FOLDER_NAME); ?>
  123.                                 <?php echo $categories_list ?>
  124.                             </span>
  125.                         <?php endif; ?>
  126.                     <?php endif; ?>
  127.  
  128.                     <?php if (TMM::get_option("blog_single_show_comments")) : ?>
  129.                         <span class="comments"><a href="<?php the_permalink() ?>#comments"><?php echo get_comments_number(); ?> <?php _e('Comments', TMM_THEME_FOLDER_NAME); ?></a></span>
  130.                     <?php endif; ?>
  131.  
  132.                 </div><!--/ .entry-meta-->
  133.  
  134.             <?php endif; ?>
  135.  
  136.             <div class="entry-body">
  137.  
  138.                 <?php the_content() ?>
  139.                 <?php TMM_Ext_LayoutConstructor::draw_front($post->ID); ?>
  140.  
  141.                 <?php if (TMM::get_option("blog_single_show_bio")): ?>
  142.                     <?php $user = get_userdata($post->post_author); ?>
  143.                     <?php if (is_object($user)): ?>
  144.                         <div class="author-about">
  145.  
  146.                             <div class="author-thumb">
  147.  
  148.                                 <div class="avatar">
  149.                                     <?php
  150.                                     $avatar_url = get_avatar($user->ID, 60);
  151.                                     $avatar_url = TMM_Helper::is_file_url_exists($avatar_url) ? $avatar_url : TMM_THEME_URI . '/admin/images/gravatar.jpg';
  152.                                     ?>
  153.                                     <img src="<?php echo $avatar_url; ?>" alt="">
  154.                                 </div>
  155.  
  156.                             </div><!--/ .author-thumb-->
  157.  
  158.                             <div class="author-entry">
  159.  
  160.                                 <h5><?php _e('About the Author', TMM_THEME_FOLDER_NAME); ?></h5>
  161.                                 <p><?php echo stripslashes($user->description); ?></p>
  162.  
  163.                             </div><!--/ .author-entry-->
  164.  
  165.                         </div><!--/ .about-author-->
  166.                     <?php endif; ?>
  167.                 </div><!--/ .entry-body-->
  168.  
  169.             <?php endif; ?>
  170.  
  171.         </article><!--/ .entry-->
  172.  
  173.         <?php if (TMM::get_option("blog_single_show_comments")): ?>
  174.  
  175.             <?php comments_template(); ?>
  176.  
  177.         <?php endif; ?>
  178.  
  179.         <?php
  180.     endwhile;
  181. endif;
  182. ?>
  183.  
  184. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement