Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Reads the shortcode and show FAQs
- *
- * @since 1.0
- * @param array $args Params
- */
- public function shortcode( $args )
- {
- ob_start();
- echo $this->display_faq($args);
- $output_string = ob_get_contents();
- ob_end_clean();
- return $output_string;
- }
- /**
- * Show FAQ
- *
- * @since 1.0
- * @param array $args Options
- * @return void
- */
- public function display_faq( $args = array() )
- {
- $faq = $this->get_faq( $args );
- extract( $args, EXTR_SKIP );
- $thiscat = '';
- $categories = get_terms( $this->category_taxonomy, 'hide_empty=0' );
- foreach ( (array)$categories as $cat )
- {
- if( $cat->slug == $category )
- $thiscat = $cat->name;
- }
- $output = '<h2>' . $thiscat . ' FAQ</h2><div class="apiki-wp-faq-show">';
- if( empty( $faq ) || is_wp_error( $faq ) ) :
- $output .= __( 'No FAQ found.', $this->text_domain );
- else :
- $output .= '<ul>';
- foreach( (array)$faq as $_faq )
- $output .= sprintf( '<li><a href="%1$s" title="%2$s">%2$s</a></li>', get_permalink( $_faq->ID ), $_faq->post_title );
- $output .= '</ul>';
- endif;
- $output .= '</div>';
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement