Hi,
Thanks for reaching out! You can adjust the text using a plugin like this: https://wordpress.org/plugins/say-what/
To add a link to the desired category you would need to add a custom function into a child theme. I don’t believe there’s a simple way to adjust it. Sorry!
Kindly,
Hannah
@hannahritner Yes, that’s what I was hoping for. I used Astra before and I had a custom function added to the child theme for this purpose. I’m already using a child theme with Kadence. Do you have a custom function for this by any chance? I’d rather not install any more plugins if at all possible, even more so if from what I understand the plugin mentioned won’t add the name of the post’s category. Thanks!
@hannahritner Okay, so I found in the knowledge base the function that changes the text output to read Similar Posts to {post-title}. Is it possible to change the text output to read Similar Posts to {post-category-name} instead? I tried replacing get_the_title() with get_the_category() but it’s obviously not enough. Thank you so much!
Hey Laura,
Apologies for the delay! It looks like you started a new thread regarding this? I’ll make sure our dev team takes a look and gives some input.
Thanks for your patience!
Best,
Hannah
@hannahritner Yes, I started a new thread, but it’s on a related topic, not exactly the same thing since the other thread has to do with the header tag for the related post titles not the ‘Similar posts’ title text itself.
Hi, @lauratraveler!
You can go to our knowledgebase article for custom code snippets you can use -https://www.kadencewp.com/kadence-theme/knowledge-base/advanced/changing-various-heading-html-tags/.
So to show text like, “Similar Posts under Category name”, you can edit the code snippet from the article to:
/**
* Change the similar posts title output.
*
* @param string $html the output html.
*/
function custom_similar_posts_title( $html ) {
$categories = get_the_category();
$html = '<h4 class="entry-related-title">' . esc_html__( 'Similar Posts under ', 'custom-text-domain' ) . esc_html( $categories[0]->name ) .'</h4>';
return $html;
}
add_filter( 'kadence_single_post_similar_posts_title', 'custom_similar_posts_title' );
However, since a post could have multiple categories, the code above will only show the first category returned by the function.
I hope this helps and let us know if we can assist you further.
Regards,
Karla
@karlalevelup This is awesome! Thank you so much! I only use one category per post for this specific purpose, so it works great! 🙂