Advertisement
rcostica

Wordpress Slideshow

Oct 28th, 2011
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. function padd_theme_post_slideshow($exclude=array()) {
  2.     wp_reset_query();
  3.     $featured = Padd_Theme_Option::get('slideshow_cat_id');
  4.     $count = Padd_Theme_Option::get('slideshow_cat_limit');
  5.     query_posts('showposts=' . $count . '&cat=' . $featured);
  6.     $padd_image_def = get_template_directory_uri() . '/images/thumbnail-slideshow.jpg';
  7.     add_filter('excerpt_length', 'padd_theme_hook_excerpt_slideshow_length');
  8. ?>
  9. <div id="slideshow-box">
  10.     <div class="list">
  11.     <?php while (have_posts()) : the_post(); ?>
  12.         <div class="item">
  13.             <div class="image">
  14.                 <a href="<?php the_permalink(); ?>" title="Permanent Link to <?php the_title_attribute(); ?>">
  15.                 <?php
  16.                     $exclude[] = get_the_ID();
  17.                     if (has_post_thumbnail()) {
  18.                         the_post_thumbnail(PADD_THEME_SLUG . '-slideshow', array('title' => get_the_excerpt()));
  19.                     } else {
  20.                         echo '<img class="thumbnail" src="' . $padd_image_def . '" />';
  21.                     }
  22.                 ?>
  23.                 </a>
  24.             </div>
  25.             <div class="meta">
  26.                 <h3><a href="<?php the_permalink(); ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><?php padd_theme_trim_title(25); ?></a></h3>
  27.                 <?php the_excerpt(); ?>
  28.                 <p class="read-more"><a href="<?php the_permalink(); ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><span>Read More</span></a></p>
  29.             </div>
  30.             <div class="clear"></div>
  31.         </div>
  32.     <?php endwhile; ?>
  33.     </div>
  34. </div>
  35. <?php
  36.     wp_reset_query();
  37.     remove_filter('excerpt_length','padd_theme_hook_excerpt_slideshow_length');
  38.     return $exclude;
  39. }
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement