I'm trying to setup a multi-topic blog.

My topics are:

  1. Food
  2. Lifestyle
  3. Fiction
  4. Digital Reality

I have 4 different logos for each category and want to display them depending on the category of the article.

The URL slug will have the category mentioned in it. Please help me display logo depending on the category.

Would be amazing if this can be done by editing the child theme.

Thank you.

  • Hi Jijo Jose, could you provide more details on what you've tried already (and why it didn't work)? – kraftner Feb 20 '17 at 10:23
  • @kraftner I tried following steps in this article but this is not good in the long run as I'll have to upload the logo in every article published. streetsmash.com/dynamic-logo-in-a-wordpress-theme – Jijo Jose Feb 20 '17 at 10:30

You could check the current category and apply a different class with each logo,

$cur_topic = $queried_object->slug;

$my_class = 'default-logo';

switch ($cur_topic) {
    case "food":
        $my_class = 'food-logo';
    case "lifestyle":
        $my_class = 'lifestyle-logo';
    case "fiction":
        $my_class = 'fiction-logo';
        $my_class = 'default-logo';

echo '<div class="' . $my_class . '"></div>';

Alternatively, check out the following plugin:


  • Can you please simplify the steps for me? I'm not experienced. Thank you. – Jijo Jose Feb 20 '17 at 10:50
  • In your category (category.php or archive.php, or header.php if you are using it there) you can get the slug of the current category with the following: $queried_object->slug; Use this slug in a switch statement to select the appropriate css class for your logo container, which subsequently displays the correct logo. OR - use the plugin I linked to to add images to each category in the backend as taxonomy meta and take a look at their documentation to display. – Svartbaard Feb 20 '17 at 10:53

You can add class to logo container and use logo as background image via css. as said above by @Svartbaard.


you can use is_category() function and load different header for each category. for example you can visit Here

Another Option could be you can use "Categories Images" plugins and asign different images for each category and display category image in archive template using function provided by Plugins

<?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.