esc_html__( 'Faq records based on category', 'manual' ), )
);
}
// This is where the action happens
public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', $instance['title'] );
if( $instance['cat_count'] == 1 ) { $show_count = 1; } else { $show_count = 0; }
if( $instance['cat_hierarchy'] == 1 ) { $cat_hierarchy = 1; } else { $cat_hierarchy = 0; }
// before and after widget arguments are defined by themes
echo wp_kses_post($args['before_widget']);
echo '
';
if ( ! empty( $title ) ) echo '
';
$customPostTaxonomies = get_object_taxonomies('manual_faq');
if(count($customPostTaxonomies) > 0) {
echo '
';
foreach($customPostTaxonomies as $tax) {
wp_list_categories( array(
'orderby' => 'name',
'show_count' => $show_count,
'pad_counts' => 0,
'hierarchical' => $cat_hierarchy,
'taxonomy' => $tax,
'title_li' => ''
) );
}
echo '
';
}
echo '
';
echo '
';
echo wp_kses_post($args['after_widget']);
}
// Widget Backend
public function form( $instance ) {
if ( isset( $instance[ 'title' ] ) ) {
$title = $instance[ 'title' ];
} else {
$title = esc_html__( 'New title', 'manual' );
}
$cat_count = (isset($instance[ 'cat_count' ])?$instance[ 'cat_count' ]:'');
$cat_hierarchy = (isset($instance[ 'cat_hierarchy' ])?$instance[ 'cat_hierarchy' ]:'');
?>
/>
/>
esc_html__( 'KB records based on category', 'manual' ), )
);
}
// This is where the action happens
public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', $instance['title'] );
if( $instance['cat_count'] == 1 ) { $show_count = 1; } else { $show_count = 0; }
if( $instance['cat_hierarchy'] == 1 ) { $cat_hierarchy = 1; } else { $cat_hierarchy = 0; }
// before and after widget arguments are defined by themes
echo wp_kses_post($args['before_widget']);
echo '';
if ( ! empty( $title ) ) echo '
';
$customPostTaxonomies = get_object_taxonomies('manual_kb');
if(count($customPostTaxonomies) > 0) {
echo '
';
foreach($customPostTaxonomies as $tax) {
wp_list_categories( array(
'orderby' => 'name',
'show_count' => $show_count,
'pad_counts' => 0,
'hierarchical' => $cat_hierarchy,
'taxonomy' => $tax,
'title_li' => ''
) );
}
echo '
';
}
echo '
';
echo '
';
echo wp_kses_post($args['after_widget']);
}
// Widget Backend
public function form( $instance ) {
if ( isset( $instance[ 'title' ] ) ) {
$title = $instance[ 'title' ];
} else {
$title = esc_html__( 'New title', 'manual' );
}
$cat_count = (isset($instance[ 'cat_count' ])?$instance[ 'cat_count' ]:'');
$cat_hierarchy = (isset($instance[ 'cat_hierarchy' ])?$instance[ 'cat_hierarchy' ]:'');
?>
/>
/>