post-carousel.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Flexible Posts Widget: Custom widget template
  4. *
  5. * @since 3.4.0
  6. *
  7. * This is a custom template used by the plugin.
  8. * Listing price and excerpt below the image.
  9. */
  10. // Block direct requests.
  11. if ( ! defined( 'ABSPATH' ) ) {
  12. die( '-1' );
  13. }
  14. echo $before_widget;
  15. if ( ! empty( $title ) ) {
  16. echo $before_title . $title . $after_title;
  17. }
  18. if ( $flexible_posts->have_posts() ) :
  19. ?>
  20. <ul class="home-carousel">
  21. <?php while ( $flexible_posts->have_posts() ) : $flexible_posts->the_post(); global $post; ?>
  22. <li id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  23. <a href="<?php echo the_permalink(); ?>" class="listing-link">
  24. <?php
  25. if ( true == $thumbnail ) {
  26. // if the post has a feature image, show it.
  27. if ( has_post_thumbnail() ) {
  28. the_post_thumbnail( $thumbsize );
  29. // else if the post has a mime type that starts with "image/" then show the image directly.
  30. } elseif ( 'image/' == substr( $post->post_mime_type, 0, 6 ) ) {
  31. echo wp_get_attachment_image( $post->ID, $thumbsize );
  32. }
  33. }
  34. ?>
  35. <div class="title">
  36. <?php the_title(); ?>
  37. </div>
  38. </a>
  39. </li>
  40. <?php endwhile; ?>
  41. </ul><!-- .dpe-flexible-posts -->
  42. <?php
  43. endif; // End have_posts().
  44. echo $after_widget;