evolve_posts_slider

The evolve evolve posts slider function.

Description

evolve_posts_slider(); 

Usage

  1. if ( !function_exists( 'evolve_posts_slider' ) ) { 
  2. require_once '/library/functions/basic-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = evolve_posts_slider(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/library/functions/basic-functions.php  
  1. function evolve_posts_slider() { 
  2. ?> 
  3. <div id="slide_holder"> 
  4. <div class="slide-container"> 
  5.  
  6. <ul id="slides"> 
  7.  
  8. <?php 
  9. $number_items = evolve_get_option('evl_posts_number', '5'); 
  10. $slider_content = evolve_get_option('evl_posts_slider_content', 'recent'); 
  11. $slider_content_category = ''; 
  12. $slider_content_category = evolve_get_option('evl_posts_slider_id', ''); 
  13. //make array categories into string with commas. 
  14. if (is_array($slider_content_category)) { 
  15. $slider_content_category = implode(", ", $slider_content_category); 
  16.  
  17. if ($slider_content == "category" && !empty($slider_content_category)) { 
  18. $slider_content_ID = $slider_content_category; 
  19. } else { 
  20. $slider_content_ID = ''; 
  21.  
  22. $args = array( 
  23. 'cat' => $slider_content_ID,  
  24. 'showposts' => $number_items,  
  25. 'ignore_sticky_posts' => 1,  
  26. ); 
  27. query_posts($args); 
  28.  
  29. if (have_posts()) : $featured = new WP_Query($args); 
  30. while ($featured->have_posts()) : $featured->the_post(); 
  31. ?> 
  32.  
  33. <li class="slide"> 
  34.  
  35. <?php 
  36. if (has_post_thumbnail()) { 
  37. echo '<div class="featured-thumbnail"><a href="'; 
  38. the_permalink(); 
  39. echo '">'; 
  40. the_post_thumbnail('slider-thumbnail'); 
  41. echo '</a></div>'; 
  42. } else { 
  43. $image = evolve_get_first_image(); 
  44. if ($image): 
  45. echo '<div class="featured-thumbnail"><a href="'; 
  46. the_permalink(); 
  47. echo '"><img src="' . $image . '" alt="'; 
  48. the_title(); 
  49. echo '" /></a></div>'; 
  50. endif; 
  51. ?> 
  52.  
  53. <h2 class="featured-title"> 
  54. <a class="title" href="<?php the_permalink() ?>"> 
  55. <?php 
  56. $title = the_title('', '', false); 
  57. $length = evolve_get_option('evl_posts_slider_title_length', 40); 
  58. echo evolve_truncate($title, $length, '...'); 
  59. ?> 
  60. </a> 
  61. </h2> 
  62.  
  63. <p><?php 
  64. $excerpt_length = evolve_get_option('evl_posts_slider_excerpt_length', 40); 
  65. echo evolve_excerpt_max_charlength($excerpt_length); 
  66. ?></p> 
  67. <a class="button post-more" href="<?php the_permalink(); ?>"><?php _e('Read More', 'evolve'); ?></a> 
  68.  
  69. </li> 
  70.  
  71. <?php 
  72. endwhile; 
  73. else: 
  74. ?> 
  75. <li><?php _e('<h2 style="color:#fff;">Oops, no posts to display! Please check your post slider Category (ID) settings</h2>', 'evolve'); ?></li> 
  76.  
  77. <?php 
  78. endif; 
  79. wp_reset_query(); 
  80. ?> 
  81. </ul> 
  82. </div> 
  83. </div> 
  84. <?php