How to add Custom Testimonial Code and Shortcode
Function.php
add_filter( 'widget_tag_cloud_args', 'twentysixteen_widget_tag_cloud_args' );
add_action( 'init', 'create_post_type' );function create_post_type() { register_post_type( 'testimonial', array( 'labels' => array( 'name' => __( 'Testimonial' ), 'singular_name' => __( 'testimonial' ) ), 'public' => true, 'has_archive' => true, ) );}
CUSTOMTEMPLATE.php
<div class="carousel-inner">
<?php
$args = array( 'posts_per_page' => -1, 'post_type' => 'testimonial' );
$i=0;
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<!-- Quote 1 -->
<div class="item <?php if($i==0) { ?> active <?php } else { } ?>">
<div class="col-sm-12 block-quote">
<?php the_content();?>
<small><?php the_author(); on ?></small>
</div>
</div>
<?php
$i++;
endforeach;
wp_reset_postdata();?>
Comments
Post a Comment