How to Create a Custom “Read More” Excerpt in WordPress Posts
Photo By Souvik Banerjee on Unsplash
Creating a custom “Read More” excerpt for WordPress posts is a great way to enhance navigation and user experience on your website. An excerpt is a summary of a post displayed on archive pages, category pages, or the homepage.
This time, Mamang will write a simple script commonly used in WordPress development to create a custom excerpt for posts.
How do you do it? It’s quite easy! You just need to add a filter function. Typically, a collection of functions is stored in the functions.php file. Here’s the script :
function get_excerpt_more($more) { global $post; return ' ...<div class="view-full-post"> <a href="' . get_permalink($post->ID) . '" class="btn btn-default">Read More</a> </div>'; } add_filter('excerpt_more', 'et_excerpt_more');
By following and trying the above code, you can create a custom “Read More” excerpt for WordPress posts. This not only makes your website look more professional but also helps improve user navigation and encourages them to read more.
That’s the explanation of Creating a Custom “Read More” Excerpt for WordPress Posts that Mangcoding can share. Hopefully, this article is useful and provides new insights for you. If you have constructive feedback or suggestions, feel free to leave a comment or contact us via email and Mangcoding’s social media.