Answer the question
In order to leave comments, you need to log in
How to display in wordpress subcategories (children) in a category (in the parent one) in the form of blocks (image, text ..)?
Is it possible to display subcategories (children) in a category (parent) in WordPress as blocks with an image, a title and a display of the number of posts of the subcategory?
How to display: in the site menu there is a Movies category, on the page of which its child subcategories (Comedies, Horrors, Thrillers, etc.) should be displayed with a picture, title and number of entries. When adding a new child category, it should also appear in the Movies category.
The output of the image, title and display of the number of records could be done through the plugin Images of taxonomies
. Here is the code that turned out:
<?php foreach (get_the_category() as $cat) : ?>
<div class="box_video">
<div class="video-test">
<div class="box_video_ptr">
<a href="<?php echo get_category_link($cat->term_id); ?>"><img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>"/></a>
</div>
<div class="box_video_txt">
<h2><a href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->cat_name; ?></a></h2>
<p><span><?php echo $cat->count; ?> видео</span></p>
</div>
</div>
</div>
<?php endforeach; ?>
Answer the question
In order to leave comments, you need to log in
Better through get_categories - wp-kama.ru/function/get_categories (Title, description)
The image is available through the taxonomy images plugin - https://ru.wordpress.org/plugins/taxonomy-images/
Number of entries - get_terms - https:// developer.wordpress.org/reference/function...
----
If you are unfamiliar with php, then this will be a little tricky. You can look for a ready-made solution, or contact a specialist
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question