2008-07-21

Blogging Tip : Making expandable blog posts with links


A key benefit to including a "Continue reading... " link, "Read more..." link or whatever name you want it to be, is you may place few articles on homepage instead of having few number of long posts/articles to read on. Thus, you're making the server to fetch a long data and it will affect your page loading time. In other words, you'll be able to hide all post content behind a link. When the link is clicked, the user will be sent to the post page, where the entire text of the post will become visible. This guide will explain how this can be done.

Login to your Dashboard> Layout> Edit Html. Check the Expand Widget Templates. Copy the code below and place it right between the closing b:skin tag and the closing head tag.

<style>
<b:if cond='data:blog.pageType == "item"'>
span.fullpost {display:inline;}
.rmlink {
display:none;
font-weight:bold;
float:right;
}
<b:else/>
span.fullpost {display:none;}
.rmlink {
display:inline;
font-weight:bold;
float:right;
}
</b:if>
</style>


Press Ctrl+F and type <data:post.body/> in the search box.


And place the below code right after it.

<span class='rmlink'><a expr:href='data:post.url'>-&gt;Read More...</a></span>


Save the settings.

Lastly, click on Settings> Formatting and at the bottom, you will find the text box provided to specify the "Post template". Copy/paste these lines into that text box and save the settings.

Type your summary here.
<span id="fullpost">
Type the rest of your post here.
</span>



Save the settings and you're done with it. From now on, your post editor is divided into 2 sections - type your summary and type the rest of your post.

3 comments:

Anonymous said...

Hi Friend.. Thanks for your share..
Is, how to get Wordpress readmore but use a javascript? Thanks

Is said...

Anton,
In your Administration > Write > Post SubPanel, you'll find a little button above the editing window which is called the quicktag. Put your cursor where you want to end the excerpted content of your post and click the more quicktag button. If you want to change the words from more.... to something else, just type in the new words into the tag such as Continue reading...

Is said...

Anton,
In future, please forward support requests to the WordPress Support Forums. TQ

Post a Comment

1. Comments posted must be accompanied by names or pseudonyms.
2. Anonymous posting and those containing profanities will be rejected.
3. Comments are moderated due to spam problems. I have to approve the comment before it will show up.

:)) ;)) ;;) :D ;) :p :(( :) :( :X
=(( :-o :-/ :-* :| 8-} :)] :-t b-( :-L