Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add Shortcode
- function pu_last_trips() {?>
- <div class="elementor-row">
- <?php // WP_Query arguments
- $args = array(
- 'post_type' => array( 'trips' ),
- 'posts_per_page' => '3',
- );
- // The Query
- $trips = new WP_Query( $args );
- // The Loop
- if ( $trips->have_posts() ) {
- while ( $trips->have_posts() ) {
- $trips->the_post();
- $post_id = get_the_ID();
- ?>
- <div class="elementor-column elementor-element elementor-col-33 elementor-top-column pu-trip-culmn" data-element_type="column">
- <div class="elementor-column-wrap elementor-element-populated pu-trip-culmn-bg">
- <div class="elementor-widget-wrap">
- <div class="elementor-widget elementor-element elementor-element-ea4gqit elementor-widget-image" data-element_type="image.default">
- <div class="elementor-widget-container">
- <div class="elementor-image">
- <a href="<?php the_permalink(); ?>"><?php pu_post_img($post_id); ?> </a>
- </div>
- </div>
- </div>
- <div class="elementor-widget elementor-element elementor-element-8xce8u7 elementor-widget-heading" data-element_type="heading.default">
- <div class="elementor-widget-container">
- <h3 class="elementor-heading-title elementor-size-default"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> </div>
- </div>
- <div class="elementor-widget elementor-element elementor-element-6g0ddya elementor-widget-text-editor" data-element_type="text-editor.default">
- <div class="elementor-widget-container">
- <div class="elementor-text-editor elementor-clearfix"><p><?php the_excerpt(); ?></p></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?php }
- } else {
- // no posts found
- }
- // Restore original Post Data
- wp_reset_postdata();
- }?>
- </div>
- <?php
- add_shortcode( 'puLastTrips', 'pu_last_trips' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement