Show Category Slider instead of BIG GRID od category pages

Posted in: Newsmag
Post count: 10

Hi there,
we use your Newsmag 1.3 theme (we made a lot of changes, we must not upgrade 🙂 ), and we need just need to replace Big Grid with Slider in category pages. so the easiest way to do this?

page-category-header.php

Post count: 10

this can be accomplished by

<?php echo do_shortcode ('[td_slide autoplay="3" category_id="48" limit="5" td_filter_default_txt="All"]'); ?>

but we need autodetect category

Post count: 6535

Hi

I assume that you want to display the big grid on a specific category page. This can be done using is_category() function. This function returns true when a specific category page is displayed, you can read more details here: https://developer.wordpress.org/reference/functions/is_category/
In your case the code could be like this:

<?php
if (is_category('category-name')){
 echo do_shortcode ('[td_slide autoplay="3" category_id="48" limit="5" td_filter_default_txt="All"]'); 
}
?>

Let me know how it goes and if this is not what you mean please provide more specific details about what you’re trying to do so I can inspect this closer and get back to you with a more accurate answer.

Thanks!

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

HI Andrei,
I found solution 🙂 this code display Slider on every category page:

$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
echo do_shortcode ('[td_slide autoplay="3" category_id="'.$category_id.'" limit="5" td_filter_default_txt="All"]');

Post count: 6535

Hi

Glad you managed to find a solution.
Thanks for letting us know and for your message!

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newsmag’ is closed to new topics and replies.