I am trying to display the custom taxonomy in author page with a counter but seems i don't know how to do it.
i have a code in function.php
add_action( 'pre_get_posts', function ( $q ) {
if( !is_admin() && $q->is_main_query() && $q->is_author() ) {
$q->set( 'posts_per_page', 100 );
$q->set( 'post_type', 'custom_feedback' );
}
});
and in my author page :
<div class="feedback-respond">
<h3 class="feedback-title">User Feedback </h3>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p><?php _e('No posts by this author.'); ?></p>
<?php endif; ?>
</div>
The code works for all the author profile but i don't know how to get the the custom taxonomy to display like this:
User Feedback
6 POSITIVE feedback 4 NEGATIVE feedback
all feedback goes here
all feedback goes here
all feedback goes here
By the way it is a custom post type (custom_feedback)and custom taxonomy(feedback_taxonomy) with two category Positive and Negative.
Please help masters?
positive
ornegative
. If you have 10 posts, you need to know how many posts belongs tonegative
and how many belongs topositive
. – Misdo