Custom post type shortcode

I create a custom post type (features) in my theme with the help of advanced custom field plugins. I want to know how i can create a shortcodes of my custom post type. so that i just used a shortcode of that custom post type of any page to display a informations that i added in my custom post type (features).

this is my code :

<div class=”row”>
<div class=”main_feature text-center”>
$feature = array( ‘post_type’ => ‘features’,);

$feature_query = new WP_Query( $feature );

if(have_posts() ) : while($feature_query->have_posts() ) : $feature_query->the_post();

<div class=”col-sm-3″>
<div class=”single_feature”>
<div class=”single_feature_icon”>
<?php the_field(‘feature_icon’) ;?>
<!–<i class=”fa fa-clone”></i>–>

<h4><?php the_title(); ?></h4>
<div class=”separator3″></div>
<p><?php the_content(); ?></p>

<?php endwhile; endif ?>

Read more here:: Custom post type shortcode

Leave a Reply

Your email address will not be published. Required fields are marked *