Before you ask please READ THIS

Different images for category listings

edited January 2017 in FatMoon Posts: 15
Is it possible to have different images as background of the title bar for post listings of different categories?
I tried to add images with the plugin Categories Images but these don't show up in the category listing.
https://wordpress.org/plugins/categories-images/
There is a custom code to add to the template but I'm not sure where to add it.
Or is there another way to do this?
Post edited by avirili on

Comments

  • AirAir
    Posts: 10,970
    Hello:-)

    I don't think that this plugin will know how layout of our theme is made;-)

    If you want dif
    ferent images for different categories then you will have to use custom CSS.

    Please show me link to your example category and I will give you instructions what to do.

    With kind regards.
  • edited January 2017 Posts: 15
    Of course they don't know how your template is made ;) But the plugin site says:
    Use <?php if (function_exists('z_taxonomy_image_url')) echo z_taxonomy_image_url(); ?>
    to get the url and put it in any img tag or simply use
    <?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(); ?>
    in (category or taxonomy) template.

    I'm not sure where to add this code.
    Post edited by avirili on
  • AirAir
    Posts: 10,970
    Oooo like this you say. Still it won't work cause we define them in user.css file that is created dynamically.

    Use this custom CSS:

    .posts-list.category-my-weddings .title-bar.outside {
    background-image: url(http://yoursite.com/wp-content/uploads/2017/01/LM-568.jpg);
    }
    .posts-list.category-trends-tips .title-bar.outside {
    background-image: url(http://yoursite.com/wp-content/uploads/2017/01/otherimage.jpg);
    }
    As you can see you just change slug of your category. You can see what you should exactly use by viewing source of your page while viewing category and look for <body> element.
    <body id="top" class="archive category category-trends-tips ...

    With kind regards.
  • Posts: 15
    Ok so the plugin is not needed, right?
  • Posts: 15
    It works perfectly, thank you!
  • AirAir
    Posts: 10,970
    That is great! And yes, you wont be needing this plugin.

    With kind regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!