The title, the permalinks & even the field of ACF do work smoothly. But the code is not reactive to project categories, when I echo wp_list_categories(); it shows the list of message posts only. How do I specify that it should echo project categories instead? Current code:
$args = array( 'post_type' => 'project', 'posts_per_page' => 10);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<ul>';
echo '<li>';the_title(); echo '</li>';
echo '<li>';wp_list_categories(); echo '</li>';
echo '<li>';the_category(); echo '</li>';
echo '<li>';the_field(Prijs); echo '</li>';
echo '</ul>';
endwhile;
The title, the permalinks & even the field of ACF do work smoothly. But the code is not reactive to project categories, when I echo wp_list_categories(); it shows the list of message posts only. How do I specify that it should echo project categories instead? Current code:
$args = array( 'post_type' => 'project', 'posts_per_page' => 10);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<ul>';
echo '<li>';the_title(); echo '</li>';
echo '<li>';wp_list_categories(); echo '</li>';
echo '<li>';the_category(); echo '</li>';
echo '<li>';the_field(Prijs); echo '</li>';
echo '</ul>';
endwhile;
the_category
and wp_list_categories
are for the category
taxonomy term. What most people call a category is most likely a taxonomy. Category is just a default taxonomy for the post
post type.
You need to use the general taxonomy functions such as the_terms and get_the_term_list.
echo '<li>'; echo get_the_term_list($post->ID, 'project_category'); echo '</li>';
You will need to change project_category
to whatever custom taxonomy name you have used.