Here is another tutorial: How to Add Custom Text Before and After Post Title. One of the interesting tricks in WordPress, is displaying custom text or a keyword automatically before or after all old and new posts.
WordPress is a huge website’s management and development platform (CMS – Content Management System). It has incredible and powerful features that built your site exactly like you wish.
One of the interesting tricks in WordPress, is displaying custom text or a keyword automatically before or after all old and new posts. It is very helpful when you have certain or main keyword and you would like to make it appear in all posts automatically.
How to Display Custom Text or a Keyword Before and After Post Title?
The PHP file responsible of modifying the posts title, is not located in your WordPress theme editor as usual – but it’s located in wp-includes/post-template.php. So, you have to access your website’s files through FTP client or cPanel interface to be able to edit this file.
Before we go ahead, you have to take backup of “post-template.php” file – Just in case you missed something and prevent breaking your site. Open “post-template.php” file in TXT editor or code editor in cPanel and find this line.
Explanation of the_title Parameters:
$before: Write here the text that you would like to place it before the title.
$after: type here the text that you would like to display it after the title.
$echo: Don’t change this parameter, leave it as it “true” – because it display the title in your theme, but if you would like to remove or hide your post’s title then make it “false”
Example of Displaying Custom Text Before and After Post Title
Let’s make it real, i will add “How to” before the title – and – “Deeptutorials” after the title. Check the following images for the simple instruction.
Best SEO Practices
- Don’t overused.
- Don’t use irrelevant keywords to attract the visitors attention.
- Don’t use words like (visit us, click here, etc) to spam Google spiders.
- Don’t use very rich long tails keywords because it will make your title too long.
Did you found this trick useful to you, then why not share it with other. If you have any suggestions or questions, just write down in small comment below.