Advertisement
sarahn

featured.php from Aggregate theme

Mar 12th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. <?php
  2. $responsive = 'on' != get_option('aggregate_responsive_layout') ? false : true;
  3. $featured_auto_class = '';
  4. if ( 'on' == get_option('aggregate_slider_auto') ) $featured_auto_class .= ' et_slider_auto et_slider_speed_' . get_option('aggregate_slider_autospeed');
  5. ?>
  6. <div id="featured" class="<?php if ( $responsive ) echo 'flexslider' . $featured_auto_class; else echo 'et_cycle'; ?>">
  7. <a id="left-arrow" href="#"><?php esc_html_e('Previous','Aggregate'); ?></a>
  8. <a id="right-arrow" href="#"><?php esc_html_e('Next','Aggregate'); ?></a>
  9.  
  10. <?php if ( $responsive ) { ?>
  11. <ul class="slides">
  12. <?php } else { ?>
  13. <div id="slides">
  14. <?php } ?>
  15. <?php global $ids;
  16. $ids = array();
  17. $arr = array();
  18. $i=0;
  19.  
  20. $featured_cat = get_option('aggregate_feat_cat');
  21. $featured_num = (int) get_option('aggregate_featured_num');
  22.  
  23. if (get_option('aggregate_use_pages') == 'false') query_posts("showposts=$featured_num&cat=".get_cat_ID($featured_cat));
  24. else {
  25. global $pages_number;
  26.  
  27. if (get_option('aggregate_feat_pages') <> '') $featured_num = count(get_option('aggregate_feat_pages'));
  28. else $featured_num = $pages_number;
  29.  
  30. // WPML support
  31. $aggregate_feat_pages = (array) get_option('aggregate_feat_pages');
  32. $aggregate_feat_pages_new = array();
  33. foreeach($aggregate_feat_pages as $aggregate_feat_page){
  34. $aggregate_feat_pages_new[] = icl_object_id($aggregate_feat_page,'page',TRUE);
  35. }
  36. //\ WPML support
  37.  
  38. query_posts(array
  39. ('post_type' => 'page',
  40. 'orderby' => 'menu_order',
  41. 'order' => 'ASC',
  42. 'post__in' => $aggregate_feat_pages_new, // WPML support
  43. 'showposts' => (int) $featured_num
  44. ));
  45. } ?>
  46. <?php if (have_posts()) : while (have_posts()) : the_post();
  47. global $post; ?>
  48. <?php if ( $responsive ) { ?>
  49. <li class="slide">
  50. <?php } else { ?>
  51. <div class="slide">
  52. <?php } ?>
  53. <?php
  54. $width = $responsive ? 960 : 958;
  55. $height = 340;
  56. $small_width = 95;
  57. $small_height = 54;
  58. $titletext = get_the_title();
  59.  
  60. $thumbnail = get_thumbnail($width,$height,'',$titletext,$titletext,false,'Featured');
  61.  
  62. $arr[$i]['thumbnail'] = get_thumbnail($small_width,$small_height,'',$titletext,$titletext,false,'Small');
  63. $arr[$i]['titletext'] = $titletext;
  64.  
  65. $thumb = $thumbnail["thumb"];
  66. print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, ''); ?>
  67. <div class="featured-top-shadow"></div>
  68. <div class="featured-bottom-shadow"></div>
  69. <div class="featured-description">
  70. <div class="feat_desc">
  71. <p class="meta-info"><?php esc_html_e('Posted','Aggregate'); ?> <?php esc_html_e('by','Aggregate'); ?> <?php the_author_posts_link(); ?> <?php esc_html_e('on','Aggregate'); ?> <?php the_time(esc_attr(get_option('aggregate_date_format'))) ?></p>
  72. <h2 class="featured-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  73. <p><?php truncate_post(410); ?></p>
  74. </div>
  75. <a href="<?php the_permalink(); ?>" class="readmore"><?php esc_html_e('Read More', 'Aggregate'); ?></a>
  76. </div> <!-- end .description -->
  77. <?php if ( $responsive ) { ?>
  78. </li> <!-- end .slide -->
  79. <?php } else { ?>
  80. </div> <!-- end .slide -->
  81. <?php } ?>
  82. <?php $ids[] = $post->ID; $i++; endwhile; endif; wp_reset_query(); ?>
  83. <?php if ( $responsive ) { ?>
  84. </ul> <!-- end .slides -->
  85. <?php } else { ?>
  86. </div> <!-- end #slides -->
  87. <?php } ?>
  88. </div> <!-- end #featured -->
  89.  
  90. <div id="controllers" class="clearfix">
  91. <ul>
  92. <?php for ($i = 0; $i < $featured_num; $i++) { ?>
  93. <li>
  94. <div class="controller">
  95. <a href="#"<?php if ( $i == 0 ) echo ' class="active"'; ?>>
  96. <?php print_thumbnail( $arr[$i]['thumbnail']['thumb'], $arr[$i]['thumbnail']["use_timthumb"], $arr[$i]['titletext'], $small_width, $small_height ); ?>
  97. <span class="overlay"></span>
  98. </a>
  99. </div>
  100. </li>
  101. <?php } ?>
  102. </ul>
  103. <div id="active_item"></div>
  104. </div> <!-- end #controllers -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement