i would like to make a front page with the category name and under every post of the category.The code that i have tried is:
$categories_list = get_the_category_list( esc_html__( ', ', ' ' ) );
if ( $categories_list ) {
/* translators: 1: list of categories. */
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'plavou_2017' ) . '</span>', $categories_list ); // WPCS: XSS OK.
}
/* Start the Loop */
while ( have_posts() ) : the_post();
$args = array(
'exclude' => '',
'feed' => '',
);
wp_list_categories( $args );
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif; ?>
It works at one point, but i would prefer for having the categories print again for each category, better have the category and the post of it.Now it prints all the categories again for every post.