- This topic has 21 replies, 2 voices, and was last updated 5 years, 1 month ago by
David.
-
AuthorPosts
-
May 10, 2017 at 12:27 pm #316482
Ali Rand
Hi, is there a way on the Blog posts page to display the Categories above the Title, instead of the categories appearing after the title and any excerpt.
Thanks,
Ali
May 10, 2017 at 7:32 pm #316544Tom
Lead DeveloperLead DeveloperHi there,
Are the categories the only thing you want above the title? What about tags?
On the blog page only, or on the single post pages as well?
Let me know 🙂
May 11, 2017 at 5:37 am #316699Ali Rand
Hi Tom,
Just the categories on the blog page would be helpful.
Thanks.
May 11, 2017 at 10:11 am #316793Tom
Lead DeveloperLead DeveloperGive this a shot:
add_filter( 'generate_category_list_output','tu_remove_categories' ); function tu_remove_categories( $categories ) { if ( is_home() || is_archive() ) { return ''; } return $categories; } add_action( 'generate_before_entry_title','tu_cats_above_title' ); function tu_cats_above_title() { if ( is_home() || is_archive() ) { $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 ); } } }Adding PHP: https://docs.generatepress.com/article/adding-php/
May 11, 2017 at 10:24 am #316813Ali Rand
Hey Tom,
That code just removes the Categories for me. I added your code via a new Code Snippet fyi.
May 11, 2017 at 10:37 am #316819Tom
Lead DeveloperLead DeveloperHmm, that second function should add them above. Can you link me to the page?
May 11, 2017 at 10:45 am #316820Ali Rand
Thanks for looking into this…http://blue.yourtruesuccesspath.com/blog/
May 11, 2017 at 4:31 pm #316930Tom
Lead DeveloperLead DeveloperHmm.. In that second add_action() call, replace
generate_before_entry_titlewithgenerate_before_content.May 11, 2017 at 5:08 pm #316936Ali Rand
Ok, thanks, that moved it above the title. If it’s an easy fix, can it be below the featured image? So image, category, title…If not, then no worries. This will work for my next project. Thank you for your time!
May 11, 2017 at 5:21 pm #316940Tom
Lead DeveloperLead DeveloperThat’s what that first snippet of code should have done..
I would need to log in to your site to see why that didn’t work. If you want me to, feel free to send temp admin login details: https://generatepress.com/contact/
May 12, 2017 at 8:12 pm #317404Tom
Lead DeveloperLead DeveloperDo you have any custom files in your child theme? The account you sent me doesn’t have file editing permissions.
May 13, 2017 at 7:11 am #317507Ali Rand
No, all the customizations are in Simple CSS. But you can take out any of them. It was for my working on my past client’s website, and it’s been transferred over.
May 13, 2017 at 11:33 am #317599Tom
Lead DeveloperLead DeveloperAny chance you can allow file editing? Basically I need to see why that before entry title hook isn’t firing. It was added a long time ago, so I’m confused as to why it wouldn’t work.
May 13, 2017 at 11:35 am #317601Ali Rand
How do I enable that?
May 13, 2017 at 11:42 am #317602Ali Rand
It’s a multisite, so Super Admin is the highest privilege. Does going to My Sites > Network Admin > Themes not allow you to edit the files?
-
AuthorPosts
- You must be logged in to reply to this topic.