featrued image in post for one category

Posted in: Newsmag
Post count: 54

Hi,
i use DEFAULT SITE POST TEMPLATE style 7 for all the site.

But for one category i need to use td-post-featured-image like in default post style

ex :

<div class=”td-post-featured-image”></div>

Do you know how i can do that ?

thanks

Post count: 6535

Hi

You can add this code in loop-single-7.php like here: http://screencast.com/t/Q5KkKi6tsH

<?php
            // override the default featured image by the templates (single.php and home.php/index.php - blog loop)
           if (in_category('your-category-name/slug-or-id')){
               if (!empty(td_global::$load_featured_img_from_template)) {
                   echo $td_mod_single->get_image(td_global::$load_featured_img_from_template);
               } else {
                   echo $td_mod_single->get_image('td_640x480');
               }
           }

            ?>

Just add your category name or slug or id in the first condition. To get the category id follow this link: http://screencast.com/t/gvpydfeCuIu

Let me know how it goes!
Thanks!

  • This reply was modified 10 years by Andrei L..
Post count: 54

ha really great, is working really weel thanks a lot

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.