How i can generate short code of my post

Here is my custom post code can anybody guide me how I can get its short code actually I want to call on my home page which I am using avada theme and avada theme using “Fusion Builer” how I can show my home page ??

// In “function.php”
// Testimonial Custom Post

add_action( 'init', 'create_testimonial' );

function create_testimonial() {
    register_post_type( 'testimonial',
    array(
        'labels' => array(
            'name' => 'Testimonial',
            'singular_name' => 'Testimonial',
            'add_new' => 'Add New',
            'add_new_item' => 'Add New Testimonial',
            'edit' => 'Edit',
            'edit_item' => 'Edit Testimonial',
            'new_item' => 'New Testimonial',
            'view' => 'View',
            'view_item' => 'View Testimonial',
            'search_items' => 'Search Testimonial',
            'not_found' => 'No Movies found',
            'not_found_in_trash' => 'No Movies found in Trash',
            'parent' => 'Parent Testimonial'
        ),

        'public' => true,
        'menu_position' => 15,
        'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields' ),
        'taxonomies' => array( '' ),
        'menu_icon' => plugins_url( 'images/image.png', __FILE__ ),
        'has_archive' => true
    )
);

}

// In my Eidtior When i was calling POst

<?php
 $query = new WP_Query( array('post_type' => 'testimonial', 'posts_per_page' => 4 ) );
 while ( $query->have_posts() ) : $query->the_post(); ?>

    <div class="post_area">
        <div class="post_thumb">
            <?php echo the_post_thumbnail(); ?>
        </div>
        <div class="post_txt">                        
            <div class="post_cntnt"><?php the_content(); ?></div>
            <div class="post_title"><?php the_title(); ?></div>
        </div>
        <div class="clear"></div>
    </div>


<?php endwhile; ?>


Source: shortcode

Leave a Reply