Posted By

crypticsoft on 05/30/12


Tagged

plugin wordpress meteor-slides


Versions (?)

Meteor Slides : WordPress Plugin : Adding Excerpt for Slides


 / Published in: PHP
 

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.

  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
Posted By: crypticsoft on September 29, 2012

I found for adding a description for each slide that it's easier to just use the built in excerpt functionality, add this to your functions.php:

//use slide excerpt as description - so much cleaner addposttype_support('slide', 'excerpt');

You need to login to post a comment.