OwlCyberSecurity - MANAGER
Edit File: services-tabs.php
<?php /** * Services Tabs */ add_shortcode( 'pearl_services_tabs', 'pearl_services_tabs' ); function pearl_services_tabs( $atts ) { extract( shortcode_atts( array( 'number_of_posts' => 4 ), $atts ) ); ob_start(); ?> <div class="container"> <div id="tabbed-nav"> <ul> <?php $service_args = array( 'post_type' => 'service', 'posts_per_page' => $number_of_posts ); $services = get_posts( $service_args ); foreach ( $services as $post ) { ?> <li data-post="<?php $post->ID; ?>"> <a><?php echo sanitize_text_field( $post->post_title ); ?></a> </li> <?php } ?> </ul> <div> <?php $service_args = array( 'post_type' => 'service', 'posts_per_page' => $number_of_posts, ); // The Query $services = new WP_Query( $service_args ); // The Loop if ( $services->have_posts() ) { while ( $services->have_posts() ) { $services->the_post(); ?> <div data-post="<?php the_ID(); ?>"> <div class="row"> <div class="col-md-5"> <div class="welcome-serv-img"> <?php if ( has_post_thumbnail() ) : the_post_thumbnail( 'pearl_image_size_762_700' ); endif; ?> </div> </div> <div class="col-md-7"> <div class="detail detail-btn"> <h4><?php the_title(); ?></h4> <div class="ser-content"> <p><?php echo wp_trim_words( get_the_content(), 80, '...' ); ?></p> </div> <a href="<?php the_permalink(); ?>"><?php esc_html_e( 'Read More', 'pearl-medical-framework' ); ?></a> </div> </div> </div> </div> <?php } } ?> </div> </div> </div> <?php return ob_get_clean(); } /** * Services Tabs */ vc_map( array( "name" => esc_html__( "Pearl Services Tabs", 'pearl-medical-framework' ), "base" => "pearl_services_tabs", "class" => "", "category" => esc_html__( "MedicalGuide Theme", 'pearl-medical-framework' ), "params" => array( array( "type" => "dropdown", "class" => "", "heading" => esc_html__( "Number of Services 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 services posts you want to display.", 'pearl-medical-framework' ), "admin_label" => true ) ) ) );