Home › Forums › Pro Support › Display categories as tags
Tagged: categories, display tags
- This topic has 19 replies, 2 voices, and was last updated 5 years, 2 months ago by
Janek.
-
AuthorPosts
-
July 15, 2018 at 11:33 pm #5260
Janek
ParticipantGood afternoon,
Just wondering if theres a simple way to enable the display of categories on the front end within the area that displays tags. Currently I can only get my taxonomy to display if I manually select the taxonomy to display in the list. Otherwise it just shows blank. This is ok except the categories will be removed and added to on occasion and Id prefer the client not have to touch the WP Show Post settings.
I hope Im explaining this correctly.
July 16, 2018 at 9:19 pm #5266Tom
KeymasterIt’s currently not possible by default, but you may be able to do something like this:
add_filter( 'wpsp_terms_output', function( $output ) { $categories_list = sprintf( '<span class="categories-list">%s</span>', get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'wp-show-posts' ) ) ); return $output . $categories_list; } );
July 16, 2018 at 11:34 pm #5273Janek
ParticipantHey Tom,
Is there a way to remove the comma separator between the categories?
July 17, 2018 at 7:54 pm #5283Tom
KeymasterReplace:
get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'wp-show-posts' ) )
With:
get_the_category_list( '' )
July 17, 2018 at 8:09 pm #5286Janek
ParticipantAt the moment I have:
add_filter( 'wpsp_terms_output', function( $output ) { $categories_list = sprintf( '<span class="categories-list">%s</span>', get_the_category_list( '' ) ); return $output . $categories_list; } );
Yet nothing is being affected on the front end. I’m using a CPT if that matters the post type is ‘team’.
Its odd because I could have sworn the list wasnt displaying any categories in the tags without this code now everything is working fine even with the code snippet removed. I just cant get rid of that damned comma!
July 18, 2018 at 8:10 pm #5299Tom
KeymasterHmm, can you link me to the page?
July 18, 2018 at 8:30 pm #5303Janek
Participanthttp://janek-dev.flywheelsites.com/team/
Let me know if you need the logins and I’ll re-email.
July 19, 2018 at 8:12 pm #5319Tom
KeymasterYes please 🙂
We don’t store any login info, so it’s always best to email it when needed: https://wpshowposts.com/contact/
July 19, 2018 at 11:44 pm #5322Janek
ParticipantYou should have the login details now to view the site. 🙂
July 20, 2018 at 8:34 pm #5329Tom
KeymasterI’m not seeing any of the terms/categories on that page? Are terms themselves activated?
July 20, 2018 at 8:37 pm #5330Janek
ParticipantSorry I sent you the wrong page. Got confused with my support tickets.
http://janek-dev.flywheelsites.com/team/
Thats the correct one for the tags/categories!
July 21, 2018 at 10:00 pm #5335Tom
KeymasterThat’s really strange. Any other functions related to WPSP added to the site?
July 22, 2018 at 1:25 am #5340Janek
ParticipantI have a couple of snippets running, but nothing that should prevent modification of the Tags.
I disabled all of them and it still made no difference…
July 22, 2018 at 8:02 pm #5359Tom
KeymasterHmm, what if you do this?:
add_filter( 'wpsp_terms_output', function( $output ) { $categories_list = sprintf( '<span class="categories-list">%s</span>', get_the_category_list( '' ) ); return 'hi!' . $output . $categories_list; } );
Can you see the text
hi!
?July 22, 2018 at 8:42 pm #5360Janek
ParticipantYes it does! 😮
I’ve disabled the snippet temporarily. So if you visit the site now it wont show, but it was definitely outputting ‘hi’ in the tag line.
-
AuthorPosts
- You must be logged in to reply to this topic.