- This topic has 10 replies, 2 voices, and was last updated 4 years, 6 months ago by
Tom.
-
AuthorPosts
-
November 28, 2018 at 5:33 am #742614
trung
Hi GeneratePress. I need support 3 things about customize Categories in Blog Posts:
1. Move Category Link above title. I used the code in this topic but it didn’t work: https://generatepress.com/forums/topic/blog-category-above-title/#post-316793. Please support my case.
2. Use different colors for different Categories. Example: I want Category A is blue, Category B is green, Category C is yellow. How can I do?
3. Uppercase the Category names. I still want the Category name in Main navigation is in normal style(Example: Toolbox), but the Category Link in Blog Posts is in uppercase style (Example: TOOLBOX). How can I do?
Thank you.
November 28, 2018 at 5:45 am #742621November 28, 2018 at 4:49 pm #743297Tom
Lead DeveloperLead DeveloperHi there,
1. Is this code active on your site right now? It looks like it should work.
2. Posts are given a class based on their category. For example, if you have a category named “Food”, you can do this:
.category-food .cat-links a { color: red; }
3. This should do it:
.cat-links { text-transform: uppercase; }
November 29, 2018 at 7:24 am #743856trung
Hi Tom.
1. I reuse the code and it works on Blog Posts page, but it doesn’t work on Single Post. Can you support me the code to move Category Links above title in Single Post.
2 and 3. It works well.
Thank you, Tom.
November 29, 2018 at 5:45 pm #744324Tom
Lead DeveloperLead DeveloperTry this as your function:
add_filter( 'generate_category_list_output', function() { return ''; } ); add_action( 'generate_before_entry_title', function() { $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); if ( $categories_list ) { printf( '<span class="entry-meta cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x( 'Categories', 'Used before category names.', 'generatepress' ), $categories_list ); } } );
Let me know ๐
November 29, 2018 at 7:14 pm #744358trung
Hi Tom.
Your latter code works well.
But it appears one thing: when I use Customize to uncheck Display post date and Display post author, stil keep checking Display post categories => the Category Links in Blog Posts and Single Post are disappear.
Please support me about this.Thank you, Tom.
November 30, 2018 at 10:23 am #744891Tom
Lead DeveloperLead DeveloperThe above code will override the categories option in the Customizer. Are you saying that unchecking it removes the categories we’ve added with the function above?
December 1, 2018 at 3:45 am #745286trung
Yes. I give you 2 pictures of my website when your code is running. Your code works similarly on my Blog Posts page and Single Page.
– Picture 1 shows the Blog Posts page which I have unchecked Display post date and keep checking Display post categories
– Picture 2 shows the Single Post page which I keep checking Display post date and Display post categoriesPlease support me how to do if I only want to display post categories, not post date.
Thank you, Tom.
December 1, 2018 at 8:41 am #745516Tom
Lead DeveloperLead DeveloperTry adding this CSS:
.entry-header .entry-meta.cat-links { display: block; }
December 2, 2018 at 5:31 am #745925trung
Your CSS works well.
Thank you, Tom.December 2, 2018 at 8:56 am #746118Tom
Lead DeveloperLead DeveloperYou’re welcome ๐
-
AuthorPosts
- You must be logged in to reply to this topic.