Meteor Slides : WordPress Plugin : Adding Excerpt for Slides


/ Published in: PHP
Save to your folder(s)

For when you really just need a short description field along with a title for your slideshows. Just drop this into the functions.php and meteor-slideshow.php in the theme folder.


Copy this code and paste it in your HTML
  1. //add to functions.php
  2. add_post_type_support('slide', 'excerpt');
  3.  
  4. //template loop for content slides
  5. $loop = new WP_Query( array(
  6. 'post_type' => 'slide',
  7. //'slideshow' => $slideshow,
  8. 'posts_per_page' => $options['slideshow_quantity'],
  9. 'orderby' => 'ID',
  10. 'order' => 'ASC'
  11. ) );
  12.  
  13. // Loop which loads the slideshow
  14. while ( $loop->have_posts() ) : $loop->the_post();
  15.  
  16. $attr = array(
  17. 'class' => "imageItem alignleft",
  18. 'title' => get_the_title( $post->ID )
  19. );
  20. // Adds slide image with Slide URL link
  21. $slide_img = '<a href="' . get_post_meta( $post->ID, "slide_url_value", $single = true ) .'">' . get_the_post_thumbnail( $post->ID, array(285,200), 'featured-slide' ) . '</a>';
  22. $slide_desc = get_the_excerpt( $post->ID );
  23.  
  24. $result .= '<li class="royalSlide">
  25. <div class="centeredSlide" style="margin-top:28px;">
  26. <div class="slideTextBlock">
  27. <h4 class="coda">' . get_the_title( $post->ID ) . '</h4>
  28. <p>' . $slide_desc . '</p>
  29. </div>' . $slide_img . '
  30. </div>';
  31. endwhile;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.