- This topic has 5 replies, 2 voices, and was last updated 4 years ago by
Tom.
-
AuthorPosts
-
March 15, 2019 at 2:19 pm #840192
ETO
Hello,
In the category pages, there appears first the description of the category and then the links of the post in that category. However, I want the description to appear below the post links. Could you help me with this, please?GeneratePress 2.2.2GP Premium 1.7.8March 15, 2019 at 4:40 pm #840241Tom
Lead DeveloperLead DeveloperHi there,
As of right now, the description is hard-coded into the same function that displays the title. This means we can only move it if we move the title as well.
In GP 2.3, we’ll be hooking the description into the title function, which means we’ll be able to move the description elsewhere easily.
I suppose we could completely remove the element added by GP and add our own custom title and description? Would that work for you?
Let me know 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 16, 2019 at 12:55 am #840405ETO
I see. As there are tens of categories, it will be lots of work to remove and add custom titles and descriptions. So I would like to wait for GP 2.3 release.
March 16, 2019 at 8:44 am #840782Tom
Lead DeveloperLead DeveloperYou wouldn’t need to manually do anything to your categories.
You could just do this:
add_action( 'wp', function() { if ( is_category() ) { remove_action( 'generate_archive_title', 'generate_archive_title' ); add_action( 'generate_archive_title', 'tu_custom_archive_title' ); add_action( 'generate_after_main_content', 'tu_custom_archive_description' ); } } ); function tu_custom_archive_title() { ?> <div class="page-header"> <h1 class="page-title"> <?php the_archive_title(); ?> </h1> </div> <?php } function tu_custom_archive_description() { $term_description = term_description(); if ( ! empty( $term_description ) ) { printf( '<div class="taxonomy-description">%s</div>', $term_description ); // WPCS: XSS ok, sanitization ok. } }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 17, 2019 at 1:18 pm #841641ETO
Thanks. But when I use the code above the code here does not work.
March 17, 2019 at 4:34 pm #841722Tom
Lead DeveloperLead DeveloperI’m not sure I understand. How are you implementing that code?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.