How to display CPT with a shortcord
-
I made this CPT Review
$labels = array( 'name' => _x( 'Review', 'Post Type General Name', 'twentythirteen-child' ), 'singular_name' => _x( 'Review', 'Post Type Singular Name', 'twentythirteen-child' ), 'menu_name' => __( 'Review', 'twentythirteen-child' ), 'name_admin_bar' => __( 'Review', 'twentythirteen-child' ), 'archives' => __( 'ReviewArchives', 'twentythirteen-child' ), 'parent_item_colon' => __( 'Parent Review:', 'twentythirteen-child' ), 'all_items' => __( 'All Review', 'twentythirteen-child' ), 'add_new_item' => __( 'Add New Review', 'twentythirteen-child' ), 'add_new' => __( 'Add New', 'twentythirteen-child' ), 'new_item' => __( 'New Review', 'twentythirteen-child' ), 'edit_item' => __( 'Edit Review', 'twentythirteen-child' ), 'update_item' => __( 'Update Review', 'twentythirteen-child' ), 'view_item' => __( 'View Review', 'twentythirteen-child' ), 'search_items' => __( 'Search Review', 'twentythirteen-child' ), 'not_found' => __( 'Not found', 'twentythirteen-child' ), 'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen-child' ), 'featured_image' => __( 'Featured Image', 'twentythirteen-child' ), 'set_featured_image' => __( 'Set featured image', 'twentythirteen-child' ), 'remove_featured_image' => __( 'Remove featured image', 'twentythirteen-child' ), 'use_featured_image' => __( 'Use as featured image', 'twentythirteen-child' ), 'insert_into_item' => __( 'Insert into item', 'twentythirteen-child' ), 'uploaded_to_this_item' => __( 'Uploaded to this item', 'twentythirteen-child' ), 'items_list' => __( 'Slider list', 'twentythirteen-child' ), 'items_list_navigation' => __( 'Slider list navigation', 'twentythirteen-child' ), 'filter_items_list' => __( 'Filter items list', 'twentythirteen-child' ), ); $args = array( 'label' => __( 'Review', 'twentythirteen-child' ), 'description' => __( 'Review Description', 'twentythirteen-child' ), 'labels' => $labels, 'supports' => array( 'title','revisions', 'excerpt', 'editor' ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 26, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', 'menu_icon' => 'dashicons-welcome-view-site', 'rewrite' => array( 'with_front'=> false,'slug' => 'review' ), ); register_post_type( 'review', $args );
After that I made a plugin to display form at the frontend.
Now I don’t know How to show Things of The CPT to front end.
I made this code so far but no clue what to do ahead.
function display_testimonials(){ $temp = '<div class="owl-carousel testi-slider"> <div class="container"> <div class="row"> <div class="col-md-4"> <div class="testimonial text-center"> <h3>Just Perfect!</h3> <div class="separator"></div> <div class="testimonial-body"> <blockquote> <p>Sed ut perspiciatis unde omnis iste natu error sit voluptatem accusan tium dolore laud antium, totam rem dolor sit amet tristique pulvinar, turpis arcu rutrum nunc, ac laoreet turpis augue a justo.</p> </blockquote> <div class="testimonial-info-1">- Jane Doe</div> </div> </div> </div> </div> </div> <div class="container"> <div class="row"> <div class="col-md-4"> <div class="testimonial text-center"> <h3>Just Perfect!</h3> <div class="separator"></div> <div class="testimonial-body"> <blockquote> <p>Sed ut perspiciatis unde omnis iste natu error sit voluptatem accusan tium dolore laud antium, totam rem dolor sit amet tristique pulvinar, turpis arcu rutrum nunc, ac laoreet turpis augue a justo.</p> </blockquote> <div class="testimonial-info-1">- Jane Doe</div> </div> </div> </div> </div> </div> </div>'; return $temp; } add_shortcode('DT','display_testimonials');
Kindly please give your advice and help.
- The topic ‘How to display CPT with a shortcord’ is closed to new replies.