Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Show categories inside featured images Reply To: Show categories inside featured images

#19608
elvin
Moderator

Nice one,

Works like a charm! Do I need to create a new snippet for each list?

You definitely can do that if you have multiple WPSP lists and only want to apply it on some.

But if you want this applied on all of your WPSP list, you can simply remove the if condition and just do this instead.

add_action( 'wpsp_inside_image_container', function( $settings ) {
        $wpsp_cat_list = get_the_category_list(); 
		$wpsp_category = get_the_category();
		if ($wpsp_category) {
			foreach($wpsp_category as $wpsp_cat) {
			$wpsp_cat_slug = $wpsp_cat->slug; 
			}		
		}
		if($wpsp_cat_list){echo '<span class="cat_links"><span class="'.$wpsp_cat_slug.'">'.$wpsp_cat_list.'</span></span>';} 
});