OwlCyberSecurity - MANAGER
Edit File: faqs-section.php
<?php /** * FAQ Section */ add_shortcode( 'pearl_faq_section', 'pearl_faq_section' ); function pearl_faq_section( $atts ) { extract( shortcode_atts( array( 'number_of_posts' => 4, 'style' => 'simple', ), $atts ) ); ob_start(); $args = array( 'post_type' => 'faq', 'posts_per_page' => $number_of_posts ); $faq_posts = new WP_Query( $args ); $faq_id = 'procedures-faq'; $faq_class = 'accordion'; $count = 0; if ( $style == 'icon' ) { $faq_id = 'pearl-accordion'; $faq_class = 'pearl-accordion'; } if ( $faq_posts->have_posts() ) { echo '<ul id="' . $faq_id . '" class="' . $faq_class . '">'; while ( $faq_posts->have_posts() ) { $faq_posts->the_post(); $li_class = $sub_class = ''; if ( $count == 0 ) { $li_class = 'open'; $sub_class = 'display-block'; } $icon_html = ''; if ( $style == 'icon' ) { $meta_data = get_post_custom(); if ( ! empty( $meta_data['PEARL_META_icon'] ) ) { $icon_html = '<i class="' . $meta_data['PEARL_META_icon'][0] . '"></i>'; } } ?> <li class="<?php echo $li_class; ?>"> <div class="link"><?php echo $icon_html; the_title(); ?><i class="icon-chevron-down"></i></div> <ul class="submenu <?php echo $sub_class; ?>"> <li> <?php the_content(); ?> </li> </ul> </li> <?php $count ++; } echo '</div>'; } return ob_get_clean(); } /** * FAQs Section */ vc_map( array( "name" => esc_html__( "Pearl FAQs", 'pearl-medical-framework' ), "base" => "pearl_faq_section", "class" => "", "category" => esc_html__( "MedicalGuide Theme", 'pearl-medical-framework' ), "params" => array( array( "type" => "dropdown", "class" => "", "heading" => esc_html__( "Style", 'pearl-medical-framework' ), "param_name" => "style", "value" => array( 'Simple' => 'simple', 'Icon' => 'icon' ), "admin_label" => true ), array( "type" => "dropdown", "class" => "", "heading" => esc_html__( "Number of FAQs to display", 'pearl-medical-framework' ), "param_name" => "number_of_posts", "value" => array( 2, 4, 6, 8 ), "description" => esc_html__( "Select a number of faqs posts you want to display.", 'pearl-medical-framework' ), "admin_label" => true ) ) ) );