Home > Tips & Tricks > Modify Generatepress Next and Previous Post Link Text

Modify Generatepress Next and Previous Post Link Text

GeneratePress is a lightweight WordPress theme that focuses on speed, stability, and accessibility. You can start your website off in the right direction whether you’re a hobbyist, freelancer, or agency.

Generatepress theme and plugin are very easy to install and have hands-on documentation. You also can customize the parts of theme, they have 24/7 support for any solutions.

So let’s see in this trick, how we can customize the Generatepress theme and modify the Next and Previous post link text on a single page.

Change the Next / Previous Post Link Text From Post Title

To change the next and previous post link text on a single post page of the Generatepress theme, you have to add the filter hook function into the core WP code.

This filter hook function will override the link text of post pagination and you can add your own custom text like “Next post” and “Previous post”.

You can also modify the title attribute, href link tag, etc. For this trick, I’m going to change the link text.

Add the following code in the functions.php file of your Generatepress child theme. See our details guide on how to create WordPress child theme?

The above code hook will change the linking text to “Next post” and “Previous post” from “Post title”, without affecting the HTML attribute of <a> tag.

To style these Next / Previous post button, you can add the following CSS code in your stylesheet or you can add Additional CSS in Appearance/Customizer.

So after adding the filter hook to the functions file and CSS code into the stylesheet, your Next / Previous post links will look like the following images.

generatepress-next-previous-post-links

You can modify the above filter hook and style these buttons as per your requirements.

Being Tricky 😉

Photo of author

About Aman Mehra

Hey there! I'm Aman Mehra, a full-stack developer with over six years of hands-on experience in the industry. I've dedicated myself to mastering the ins and outs of PHP, WordPress, ReactJS, NodeJS, and AWS, so you can trust me to handle your web development needs with expertise and finesse. In 2021, I decided to share my knowledge and insights with the world by starting this blog. It's been an incredible journey so far, and I've had the opportunity to learn and grow alongside my readers. Whether you're a seasoned developer or just dipping your toes into the world of web development, I'm here to provide valuable content and solutions to help you succeed. So, stick around, explore the blog, and feel free to reach out if you have any questions or suggestions. Together, let's navigate the exciting world of web development!

Leave a Comment