Websites for sale:
Used Cars for Sale - $175 and Car Sale.
If interested drop me a line at ken@kensfi.com. Thanks!

Have questions about Toronto? Check my latest project: Ask about Toronto!

How to make default the [Read more]

Most WordPress blog themes we’ve met, probably more than 90% of them, display the full content of articles on the first page of the website. We do not want that. We want users to click on the article title to read more. Thus increase the number of clicks and make the site more attractive and in addition the index page will be brief.

To have a clearer idea what I’m talking about, take a look here (another blog of mine) or simply take a look on this blog home page and you’ll see articles that are not fully displayed but only with [...]. This mean you need to click the title to get into the complete article page.

You have the option to write everytime <!–more–>, or to give a click on “more” button from over the writing console, anywhere you need to split the post, but is tiring every time to do this. Let’s find out how to modify the blog template to have by default, post, all the time in this way. The method is pretty simple and you don’t need to be a guru in php (I’m not!).

To do this you need to open the index.php and search & replace the template tag the_content() with the_excerpt().
First of all you have to do a backup of index.php. Regularly I copy that file from the server on my pc, in two different folders, and I modify only one file of that two files. If it’s goes wrong I copy back the original file to the server.

The old code of my wordpress theme was:

<? if (is_home() && (!$paged || $paged == 1) || is_search() || is_single() || is_page()): ?>
<?php the_content(‘Read the rest of this entry »’); ?>
<? else: ?>

which I replaced with:

<? if (is_home() && (!$paged || $paged == 1) || is_search() || is_single() || is_page()): ?>
<?php the_excerpt() ?>

Sometimes you can get something like this:

<?php the_content(‘Read More’); ?>

or

<?php the_content(‘More »’); ?>

All you need to do in this kind of situations is to change the code to:

<?php the_excerpt() ?>

If you do not provide an explicit excerpt to a post (in the post editor’s optional excerpt field – in advanced options, under the text console), it will display a teaser which refers to the first 55 words of the post’s content. Let it by default.

Override the index.php file from the server cu modified one, test the website and drink happy a bear.:)
Done!

If you enjoyed this post, make sure you subscribe to my RSS feed!

Related Posts

How to, Tips and tricks, Wordpress Blog

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Please read before commenting:

I don't tolerate spam comments. Be human and polite. If you are signing as "Computer repairing", "iPhone store" or other kind of bullshits you'll be marked as spam.
USE YOUR NAME! Thanks!

Comments

9 Responses to “How to make default the [Read more]”

Leave Comment

(required)

(required)