OwlCyberSecurity - MANAGER
Edit File: blog-posts.php
<?php /** * Static Service */ add_shortcode( 'pearl_posts_list', 'pearl_posts_list' ); function pearl_posts_list( $atts ) { extract( shortcode_atts( array( 'number_of_posts' => 3 ), $atts ) ); ob_start(); ?> <div id="latest-news" class="latest-news"> <div class="container"> <div id="owl-demo" class="owl-carousel"> <?php $page = ''; if ( is_home() || is_front_page() ) { $page = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; } $posts_args = array( 'post_type' => 'post', 'posts_per_page' => $number_of_posts, 'paged' => $page, 'ignore_sticky_posts' => 1, 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => 'EXISTS' ), ) ); $posts = new WP_Query( $posts_args ); if ( $posts->have_posts() ) { while ( $posts->have_posts() ) { $posts->the_post(); if ( has_post_thumbnail() ) { ?> <div class="post item"> <?php the_post_thumbnail( 'pearl_image_size_712_446', array( 'class' => 'lazyOwl' ) ); ?> <div class="detail"> <?php echo get_avatar( get_the_author_meta( 'ID' ), 112 ); ?> <h4> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </h4> <p><?php echo wp_trim_words( get_the_content(), 14, '...' ); ?></p> <span><a href="<?php the_permalink(); ?>"><i class="icon-clock3"></i> <?php echo get_the_date( 'F j, Y' ); ?></a></span> <span class="comment"><a href="<?php comments_link(); ?>"><i class="icon-icons206"></i> <?php comments_number( esc_html__( 'no comments', 'pearl-medical-framework' ), esc_html__( 'one comment', 'pearl-medical-framework' ), esc_html__( '% comments', 'pearl-medical-framework' ) ); ?></a></span> </div> </div> <?php } } } ?> </div> </div> </div> <?php return ob_get_clean(); } /** * Posts List */ vc_map( array( "name" => esc_html__( "Pearl News", 'pearl-medical-framework' ), "base" => "pearl_posts_list", "class" => "", "category" => esc_html__( "MedicalGuide Theme", 'pearl-medical-framework' ), "params" => array( array( "type" => "dropdown", "class" => "", "heading" => esc_html__( "Number of News to display", 'pearl-medical-framework' ), "param_name" => "number_of_posts", "value" => array( 1, 2, 3, 4, 5, 6, 7, 8 ), "description" => esc_html__( "Select a number of news posts you want to display.", 'pearl-medical-framework' ), "admin_label" => true ) ) ) );