Answer the question
In order to leave comments, you need to log in
How to display a list of subcategories in your format?
Hello everyone, this is a question!
How can I display all subcategories in this format
<li itemscope itemtype="http://schema.org/Book" >
<a itemprop="url" href="#">
<img itemprop="image" src="images/cover/veshevedenie.png" alt="Обложка книги Вещеведенье"/>
<span itemprop="name">Вещеведенье</span>
</a>
<meta itemprop="dateModified" content="2013-09-07">
<meta itemprop="author" content="Евгений Узденский">
<meta itemprop="inLanguage" content="ru-RU">
<meta itemprop="bookFormat" content="Paperback">
<meta itemprop="numberOfPages" content="7">
</li>
<?php $sub_cat = wp_list_categories( array(
'hide_empty' => 0,
'child_of' => 9
));?>
<?php echo $sub_cat ?>
Answer the question
In order to leave comments, you need to log in
Use get_categories()
Returns an object with data about the category
All the metadata you need is missing from the standard categories API, and therefore will not be returned in any way.
However, they can be easily added using this method . How to write a category template correctly?
get something like this
Or, as a light option, you can add them to the category description through a separator
somehow, like
so
$array = explode('%%',category_description());
// URL изображения будет лежать тут - $array[0];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question