Listen to the article
Hi guys!!!
In this tutorial we are going to see how we can change the description text of the categories.
Let's do it with the GeneratePress template.
In my specific case, the description appears above the posts and I want to change it and put it below.
In this way I can create a text thinking about SEO but visually the users will see the posts as soon as they arrive, which will improve user retention on the page.
What do we need to do the tutorial
- We need the premium version of GeneratePress, you can buy it from here.
- Plugin Code Snippets
Video tutorial
Subscribe to my channel:
We want to put the category description below the posts, to do this, first we are going to remove the description and then we will add it in the place we want.
Remove Category Description in GeneratePress
To do this we are going to need to add some custom code. Let's use the plugin Code Snippets.
add_action( 'wp', function() {
remove_action( 'generate_after_archive_title', 'generate_do_archive_description' );
} );
Change site or add the description of the category where we want
Now that we've removed the description text from above altogether. Place where we did not want it, we are going to add it under the posts.
For them we need the premium version of GeneratePress since we are going to use Elements.
We add a new block type element and in the body of the content we add a GeneratePress dynamic content field of the type Term Description:
In the options below we choose where we want it to appear, in our case on the category pages, so in position we add the option File Entry Category
We only need one step, choose the specific place that we want it to appear. For this, in the options on the side, we choose Element Type: Hook and in Hook Name after_main_content
If everything went well, if you go to any category, the category description text should appear below each category.
I hope it has been useful to you 😉