- This topic has 11 replies, 2 voices, and was last updated 1 year, 1 month ago by Ying.
-
AuthorPosts
-
August 12, 2019 at 10:40 am #982287Michael
Hi,
Sometime ago, I had added this code to add the categories and tags under the titles on posts:
add_action( 'generate_after_entry_title', 'tu_add_meta_below_title' ); function tu_add_meta_below_title() { $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); $categories_list = sprintf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x( 'Categories', 'Used before category names.', 'generatepress' ), $categories_list ); $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); $tags_list = sprintf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ), $tags_list ); ?> <div class="entry-meta"> <?php echo $categories_list; ?> <?php echo $tags_list; ?> </div> <?php }
After I updated GP, these broke, no longer are seperated by commas, and no longer have their little image with them.
The attached URL is the site where I’ve updated GP.
August 12, 2019 at 4:49 pm #982484TomLead DeveloperLead DeveloperHi there,
The post you linked to only has 1 category and 1 tag, which is likely why there aren’t any commas. Is there a post I can check out that has multiple categories/tags?
As for the icons, try adding this CSS:
header.entry-header span.cat-links:before, header.entry-header span.tags-links:before { display: inline; }
Let me know π
August 13, 2019 at 7:45 am #982921MichaelHi Tom, commas reappeared by themselves…weird…maybe a cache refresh?
That CSS worked to add the icons back, but the tags and categories used to be on seperate lines like they are in the bottom section. Anyway to get that back?Also I editted by first post and included a link to a page that has multiple tages.
Thanks
Mike.August 13, 2019 at 9:50 am #983200DavidStaffCustomer SupportHi there,
try adding this CSS to stack the links:
.entry-header .cat-links, .entry-header .tags-links { display: block; }
August 13, 2019 at 12:08 pm #983304MichaelThanks man, worked like a charm. Back to its old beautiful self.
August 13, 2019 at 12:13 pm #983310DavidStaffCustomer SupportGlad we could be of help
February 23, 2023 at 11:06 am #2544432jmarcHello
This code works fine but I would like this code not to be apply on not on the archive page (homepage), only on the single post.
Is is possible please ?
Thank youMArc
February 23, 2023 at 11:47 am #2544484YingStaffCustomer SupportHi JMARC,
So only apply it to the single posts?
If so, try modifying the code to:
.single-post .entry-header .cat-links, .entry-header .tags-links { display: block; }
February 23, 2023 at 12:14 pm #2544515jmarcHello Ying and thank you but it doesn’t work π
Maybe I should explain again : I only want category and tag below the title but only on single post not on the archive(homepage).
On the homepage it’s should appear at the bottom.MArc
February 23, 2023 at 12:54 pm #2544537YingStaffCustomer SupportCan you open a new topic and attach the link to a single post?
let me know π
February 23, 2023 at 1:01 pm #2544544jmarcOf course I will
Thank you YingFebruary 23, 2023 at 2:53 pm #2544630YingStaffCustomer SupportNo problem π
-
AuthorPosts
- You must be logged in to reply to this topic.