show only active category in each faq post
This commit is contained in:
parent
9d6b78cbb4
commit
cb916bc37e
|
@ -90,3 +90,25 @@ if ( ! function_exists( 'ofisuport_display_faqs_labels' ) ) :
|
|||
<?php
|
||||
}
|
||||
endif; //end ofisuport_display_faqs_labels
|
||||
|
||||
/**
|
||||
* Displays categories for each FAQ
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'ofisuport_display_each_faq_categories' ) ) :
|
||||
function ofisuport_display_each_faq_categories() {
|
||||
|
||||
$categories = get_the_category();
|
||||
if ( ! empty( $categories ) ) {
|
||||
echo ' <nav id="tipus-faqs" class="ofisuport-faqs-types">';
|
||||
echo ' <ul class="ofisuport-label">';
|
||||
foreach ( $categories as $category ) {
|
||||
if ( ! ($category->cat_ID == '1') ) { //cat_ID '1' is defined as default FAQ
|
||||
echo '<li class="cat-item"><a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . esc_html( $category->name ) . '</a></li>';
|
||||
}
|
||||
}
|
||||
echo ' </ul>';
|
||||
echo ' </nav>';
|
||||
}
|
||||
}
|
||||
endif; //end ofisuport_display_each_faq_categories
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
if ( 'post' === get_post_type() ) :
|
||||
?>
|
||||
<div class="entry-meta">
|
||||
<?php
|
||||
ofisuport_display_faqs_labels();
|
||||
<?php
|
||||
ofisuport_display_each_faq_categories();
|
||||
//ofisuport_display_faqs_labels();
|
||||
//ofisuport_posted_on();
|
||||
//ofisuport_posted_by();
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue