Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. add_shortcode( 'objectx-pages-list', 'objectx_pages_list_func' );
  2. function objectx_pages_list_func( $atts ) {
  3. global $post;
  4. ob_start();
  5. extract( shortcode_atts( array('ids' => '1186'), $atts ) );
  6. $id_array = explode(',', $ids);
  7. $pages_query = new WP_Query( array(
  8. 'post_type' => 'page',
  9. 'post__in' => $id_array,
  10. 'order' => 'ASC',
  11. 'orderby' => 'title',
  12. ) );
  13. if ( $pages_query->have_posts() ) { ?>
  14. <div class="carousel-wrapper">
  15. <div class="owl-carousel owl-theme carousel-1" id="carousel-rooms">
  16. <?php while ( $pages_query->have_posts() ) : $pages_query->the_post();
  17. $featured_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
  18. ?>
  19. <div <?php post_class('item'); ?> id="post-<?php the_ID(); ?>">
  20. <div class="row">
  21. <div class="col-md-7">
  22. <div class="img-rooms">
  23. <a href="<?php the_permalink(); ?>">
  24. <img class="img-responsive wp-post-image" src="<?php echo $featured_image; ?>"></a>
  25. </div>
  26. </div>
  27. <div class="col-md-5">
  28. <div class="detail-rooms">
  29. <h2 class="title-room "><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  30. <?php the_excerpt(); ?>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <?php endwhile; ?>
  36. </div>
  37. </div>
  38. <?php $myvariable_pages = ob_get_clean();
  39. wp_reset_postdata();
  40. return $myvariable_pages;
  41. }
  42. }
  43.  
  44. [objectx-pages-list id="15,16,17"]
  45. [objectx-pages-list ids="25,26,27"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement