Testimonial – custom post type

/***** Adding custom post type - Testimonial *****/
function testimonials_custom_init() {
	$labels = array(
		'name' => __('Testimonials','legal'),
		'singular_name' => __('testimonials','legal'),
		'add_new' => __('Add New','legal'),
		'add_new_item' => __('Add New Testimonial','legal'),
		'edit_item' => __('Edit Testimonial','legal'),
		'new_item' => __('New Testimonial','legal'),
		'all_items' => __('All Testimonials','legal'),
		'view_item' => __('View Testimonials','legal'),
		'search_items' => __('Search Testimonial','legal'),
		'not_found' => __('No testimonials found','legal'),
		'not_found_in_trash' => __('No testimonials found in Trash','legal'),
		'parent_item_colon' => '',
		'menu_name' => __('Testimonials','legal')
	);
	$args = array(
		'labels' => $labels,
		'public' => true,
		'publicly_queryable' => true,
		'show_ui' => true,
		'show_in_menu' => true,
		'query_var' => true,
		'rewrite' => array( 'slug' => 'testimonials' ),
		'capability_type' => 'post',
		'has_archive' => true,
		'hierarchical' => false,
		'menu_position' => null,
		'supports' => array( 'title', 'editor' , 'thumbnail')
	);

register_post_type( 'testimonials', $args );
}
add_action( 'init', 'testimonials_custom_init' );

Page Template:

<div class="col-md-12 home-image-section testimonial-home">
                        <div class="blur-effect">
                            <div class="container theme-container">
                                <?php echo '<h2>' . esc_attr($legal_options['bg-title']) . '</h2>'; ?>
                                <div class="testimonial-gallarey-container">
                                    <div class="row">
                                        <div id="owl-testimonial-demo" class="gallery-row">
                                            <?php
                                            $legal_partner_args = array(
                                                'order' => 'DESC',
                                                'post_type' => 'testimonials',
                                                'posts_per_page' => -1,
                                                'post_status' => 'publish',
                                               
                                            );
                                            $legal_query_partner = new WP_Query($legal_partner_args);
                                            ?>
                                            <?php while ($legal_query_partner->have_posts()) : $legal_query_partner->the_post(); ?>
                                                <?php if (has_post_thumbnail()) : ?>
                                                    <div class="item testimonial-item">
                                                        <div class="testimonial-person">
                                                            <?php the_post_thumbnail('legal-testimonials-thumbnail-image', array('alt' => get_the_title(), 'class' => 'img-responsive')); ?>
                                                        </div>
                                                        <span><?php the_title(); ?></span>
                                                        <?php the_content(); ?>
                                                    </div>
                                                <?php endif; ?>
                                            <?php endwhile; ?>
                                        </div>
                                    </div> 
                                </div>    
                            </div>
                        </div>
                    </div>

js

jQuery(document).ready(function () {
    jQuery("#owl-client-demo").owlCarousel({
        autoPlay: 3000, //Set AutoPlay to 3 seconds
        items: 5,
        itemsDesktop: [1199, 5],
        itemsDesktopSmall: [1024, 5],
        itemsTablet: [800, 4],
        itemsSmallTablet: [767, 3],
        itemsMobile: [380, 1]
    });
});
Advertisements

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: