/*----------------------- Custom Post type Services ------------------------------------*/
//Services Post Type
add_action('init', 'services_post_type_init');
function services_post_type_init()
{
 
    $labels = array(
 
        'name' => __('Services', 'post type general name', ''),
        'singular_name' => __('Services', 'post type singular name', ''),
        'add_new' => __('Add New', 'Services', ''),
        'add_new_item' => __('Add New Services', ''),
        'edit_item' => __('Edit Services', ''),
        'new_item' => __('New Services', ''),
        'view_item' => __('View Services', ''),
        'search_items' => __('Search Services', ''),
        'not_found' =>  __('No Services found', ''),
        'not_found_in_trash' => __('No Services found in Trash', ''),
        'parent_item_colon' => ''
    );
    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'rewrite' => true,
        'query_var' => true,
        'menu_icon' => get_stylesheet_directory_uri() . '/images/testimonials.png',
        'capability_type' => 'post',
        'hierarchical' => true,
        'public' => true,
        'has_archive' => true,
        'show_in_nav_menus' => true,
        'menu_position' => null,
        'rewrite' => array(
            'slug' => 'services',
            'with_front' => true
        ),
        'supports' => array(
            'title',
            'editor',
            'thumbnail'
        )
    );
 
    register_post_type('services', $args);
}
// SHORTCODE

 
// Add Shortcode [our_services];
add_shortcode('our_services', 'codex_our_services');
function codex_our_services()
{
    ob_start();
    wp_reset_postdata();
?>
    <div class="container-fluid">
	
        <div class="services-slider ser-content">
			
            <?php
            $arg = array(
                'post_type' => 'services',
                'posts_per_page' => -1,
            );
            $po = new WP_Query($arg);
            ?>
            <?php if ($po->have_posts()) : ?>
 
                <?php while ($po->have_posts()) : ?>
                    <?php $po->the_post(); ?>
                    <div class="item">
                        <div class="ser-body">
                           <div class="thumbnail-blog">
							   <?php echo get_the_post_thumbnail(get_the_ID(), 'full'); ?>
							</div>
							
							<!-- Hover DIV-->
							<div class="content">
								<h3 class="title"><?php the_title(); ?></h3>
								<div class="excerpt">
									<?php echo wp_trim_words(get_the_content(), 25, '...'); ?>
								</div>
								<div class="readmore">
									<a href="<?php echo get_permalink() ?>">Read More</a>
								</div>
							</div>
							<!-- Hover DIV-->
							
                        </div>
                    </div>
                <?php endwhile; ?>
 
            <?php endif; ?>
        </div>
    </div>

 
<?php
    wp_reset_postdata();
    return '' . ob_get_clean();
}