1function diwp_create_shortcode_movies_post_type(){
2
3 $args = array(
4 'post_type' => 'movies',
5 'posts_per_page' => '10',
6 'publish_status' => 'published',
7 );
8
9 $query = new WP_Query($args);
10
11 if($query->have_posts()) :
12
13 while($query->have_posts()) :
14
15 $query->the_post() ;
16
17 $result .= '<div class="movie-item">';
18 $result .= '<div class="movie-poster">' . get_the_post_thumbnail() . '</div>';
19 $result .= '<div class="movie-name">' . get_the_title() . '</div>';
20 $result .= '<div class="movie-desc">' . get_the_content() . '</div>';
21 $result .= '</div>';
22
23 endwhile;
24
25 wp_reset_postdata();
26
27 endif;
28
29 return $result;
30}
31
32add_shortcode( 'movies-list', 'diwp_create_shortcode_movies_post_type' );
33
1<?php apply_filters('the_content',get_the_content( $more_link_text,
2 $stripteaser, $more_file )) ?>
3