Updated version no longer contains .$category in classes

Ticket for: Combo Blocks
0
Updated version no longer contains .$category in classes 1
Lars Krombeen
Oct 24, 2019 09:40 PM 1 Answers
Member Since Oct 2019
Subscribed Subscribe Not subscribe
Flag(0)

My question is about the Post Grid plugin, which we really like.

I have updated my version to the newest version (can't recall the previous version). In the previous version, all grid items received a class based on their category. For instance, an item belonging to category windows would have a windows CSS class.

How can I add these tags again to the items? We have logic that is written around the concept that we can derive the category form an item.

Thanks in advance.

2 Subscribers
Updated version no longer contains .$category in classes 1
Updated version no longer contains .$category in classes 3
Submit Answer
Please login to submit answer.
1 Answers
Sort By:
Best Answer
0
Updated version no longer contains .$category in classes 4
PickPlugins
Oct 25, 2019
Flag(0)

Welcome to our forum.

I guess you are using free version, by default we no longer need to display category in item class, thats why we removed it to make more less html or reduce size, but there is filter hook available to override item classes, please see the documentation.

https://pickplugins.com/documentation/post-grid/filter-hooks/post_grid_item_classes/

Hope you understand.

Regards

Updated version no longer contains .$category in classes 5
Lars Krombeen
- Oct 25, 2019 12:25 PM
Flag (0)
0

Thanks :-). I got it working by adding the following code to the functions.php file:

add_filter('post_grid_item_classes', 'post_grid_item_classes_custom');
function post_grid_item_classes_custom($classes
$classes['custom'] = get_the_category()[0]->slug;
return $classes;
}

Sign in to Reply
Replying as Submit