Site logo

Archived topic

Post Tag Styling

11 replies · Started by Leighton on January 30, 2021

Viewing posts 1–12 of 12

Hello!

I'm trying to style my post tags at the bottom of the post to achieve this look with added hover styling:
Original Style: https://imgur.com/GcwmzXD
New Style: https://imgur.com/rvp1vi0
Staging Post for Reference: https://wordpress-538093-1730059.cloudwaysapps.com/best-laptops-for-college-students/

This is the code I used.

.gp-icon.icon-tags {
	display: none!important;
}

.tags-links:before {
	content: 'Tags: ';
	font-weight: 700;
	margin-right: 10px;
}

.tags-links a {
	background-color: #f5f5f5;
	color:#000;
	font-size: 14px;
	font-weight: 400;
	padding: 2px 7px;
}

.tags-links a:hover {
	background-color: #3380ff;
	color: #fff;
}

Is this code correct? Any potential issues?

My main problem is how do I get rid of the comma separators? I can't figure that one out.

Thanks!

Works perfectly! Thanks again

No problem :)

Hi, how can we apply this filter only on the Post Page ?

add_filter( 'generate_term_separator', function() {
    return '';
} );

Thank you

Hi Simon,

Try this:

add_filter( 'generate_term_separator', function() {
if( is_single() ){
    return '';
}
} );

When i add if( is_single() ){ , the comma is also removed on blog category page, i would like to remove it only on the blog post page

Thank you

Strange. That should've worked.

Can you try this instead?

add_filter( 'generate_term_separator', function($separator) {
if( is_single() ){
    $separator = '';
} 

return $separator;
},15,1);

Can you link me to a sample single post page and the supposed blog index of the site in question? To check the actual query type of the pages.

Working well, thank you (bow)

what is the 15,1 ?

Those values are hook priority (15) and values to be accepted by the function (1 which is the $separator). :D

thanks 😎

No problem. :D

This archived topic is closed to new replies.