Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_shortcode( 'objectx-pages-list', 'objectx_pages_list_func' );
- function objectx_pages_list_func( $atts ) {
- global $post;
- ob_start();
- extract( shortcode_atts( array('ids' => '1186'), $atts ) );
- $id_array = explode(',', $ids);
- $pages_query = new WP_Query( array(
- 'post_type' => 'page',
- 'post__in' => $id_array,
- 'order' => 'ASC',
- 'orderby' => 'title',
- ) );
- if ( $pages_query->have_posts() ) { ?>
- <div class="carousel-wrapper">
- <div class="owl-carousel owl-theme carousel-1" id="carousel-rooms">
- <?php while ( $pages_query->have_posts() ) : $pages_query->the_post();
- $featured_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
- ?>
- <div <?php post_class('item'); ?> id="post-<?php the_ID(); ?>">
- <div class="row">
- <div class="col-md-7">
- <div class="img-rooms">
- <a href="<?php the_permalink(); ?>">
- <img class="img-responsive wp-post-image" src="<?php echo $featured_image; ?>"></a>
- </div>
- </div>
- <div class="col-md-5">
- <div class="detail-rooms">
- <h2 class="title-room "><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
- <?php the_excerpt(); ?>
- </div>
- </div>
- </div>
- </div>
- <?php endwhile; ?>
- </div>
- </div>
- <?php $myvariable_pages = ob_get_clean();
- wp_reset_postdata();
- return $myvariable_pages;
- }
- }
- [objectx-pages-list id="15,16,17"]
- [objectx-pages-list ids="25,26,27"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement