Archived topic
Working with Tag Description Block / Site Editor in GeneratePress?
7 replies · Started by Kip on August 17, 2022
Hi,
I'm working on a new theme redesign, in part to move off of WP Show Posts and onto Generate Blocks / Query Loop, and I have some ideas on using the Tags Archive and the Tag Description in ways some maybe non standard ways. I found this: https://wordpress.org/support/article/term-description-block/ which could get me a long way toward what I'm trying to do, can I use it with GeneratePress? Asking here first before digging too much into the weeds, thanks
Hi there,
you can use the Term Description Block, but as that is expected to appear on an Archive page, you would need to use a Block Element to add that block in an archive.
eg. a Page Hero or other Hook:
https://docs.generatepress.com/article/block-element-page-hero/
Whilst you're in a Block Element though, you will also find the GP Dynamic Content Block. Which can be used to show the psot content. the post excerpt or the Term Description :)
Thanks I will look into it, much appreciated :)
You're welcome
Hey thanks, definite progress!
I'm using a child theme of GeneratePress, and have found thanks to you that I can use the Term Description Block in a Sidebar Widget, set to show only on Archive Pages, to show the description, that's great.
However, GeneratePress shows the term description by default at the top of the archive page, how do I remove the default term description so I can show it instead in the LH widget?
Took a quick look at Archive.php in the parent theme, but not seeing where to control this.
Thanks again,
kip
Hi Kip,
You can find the code here:
https://github.com/tomusborne/generatepress/blob/adfe090929b0515cdf894f4c6b722cfe8c0790dc/inc/structure/archives.php#L94-L117
It's in thearchives.php file, you can remove the lines indicated.
Or
simply add this PHP snippet to your child theme's functions.php file:
add_action('wp', function() {
remove_action( 'generate_after_archive_title', 'generate_do_archive_description');
});
perfect, thanks!
You are welcome :)