2 Ways To Add Read More Link On WordPress

If you are using any blogging platform then you would have heard about the “read more” term. This is usually used on the homepage and the archive pages, where many articles (posts on WordPress) are listed, and every one of them has a “read more” link. Clicking on this link will take you to the complete article (single post on WordPress).

Most WordPress themes display the read more link by default. If unfortunately, your theme doesn’t, then you can add the read more link to your theme very easily.

Prerequisite

  1. Editing Functions.php file on WordPress

Adding Read More Link On WordPress

There are two ways of going about it. The first one is by copying a snippet of code in functions.php file, and the other one is by adding some code to all the files where you want the “read more” link to appear.

Method 1 (Easy)

Just paste the following code in your “functions.php” file and you will have the read more link on all the pages that use the WordPress Excerpt.

function excerpt_read_more_link($more) {     return $more . '... <a href="'. get_permalink($post->ID) . '" class="readmorelink">' . 'Read More' . '</a>'; } add_filter('the_excerpt', 'excerpt_read_more_link');

Method 2 (Advanced)

Add the below given code to all the PHP files (index.php, archive.php, author.php, search.php and others) where you want the “read more” link to appear. Make sure it comes just after the “the_excerpt();” call.

<a href="<?php echo get_permalink(); ?>" class="readmorelink"> Read More...</a>

The second method is for advanced user and gives the additional flexibility of using it on selected pages and not adding the “read more” link to all the index, archive, author, search and other pages. The “read more” link in both the codes is customizable as it has the “readmorelink” class.

Related Post