We can easily change the layout of our read more link by putting this little piece of code in a functions.php file located at the root of our theme.

if ( ! function_exists( 'wpi_read_more_link' ) ) {
    /**
     * Modify default readmore link
     * @return string with readmore paragraph
     */
    function wpi_read_more_link() {
        return '<p class="wpi-article-read-more"><a class="readmore my-class" href="' . esc_url( get_permalink() ) . '"><span> ' . esc_html( get_the_title() ) . '</span> - ' . esc_html__( 'Read more ...', 'wpi-lang' ) . '</a></p>';
    }
}
add_filter( 'the_content_more_link', 'wpi_read_more_link' );

Above example returns new read more link – outlined by paragraph with a custom class. The link has also custom classes and displays structure: post title – Read more …

I hope this will help you 🙂

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *