S
S
stichii2015-09-22 18:39:40
WordPress
stichii, 2015-09-22 18:39:40

How to set an image for subheadings in WordPress?

Good afternoon! How can I add images to subcategories. Of course, I want to do without using the plugin.
I would like to get something like this:
28f6633d34d04d20926c56a7f9718473.jpg
The code for obtaining child categories itself:

<div class=" subcat">
       <ul>
        <?php
        if (count(get_categories('child_of='.$cat)))
            if (is_category()) {
                $current_cat=get_query_var('cat');
                wp_list_categories('child_of='.$current_cat.'&title_li=&show_count=1');} ?>

       </ul>
        
    </div>

In the css file I prescribe the general styles for the subcat class. Then I assign styles for a specific subcategory: .cat-item-13{background:url(/images/topUI13.jpg) ;} and so on. And the situation is as follows, that the picture does not appear. And if you set a color in the background instead of the background image, then the color changes to the specified one. Maybe someone came across or someone knows why the background image may not appear?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Marat, 2015-09-22
@7kmarat

remove the slash ( / ) before images

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question