Quick summary: A simple plugin that gives you more control over the default “more” link generated by the <!–more–> tag.
Download: More Link Modifier (~180kb)
Tested on: v2.2.1, v2.2.2
Description:
The default link that you get from using the <!–more–> tag is Continue reading ‘title here’ and has an anchor link that jumps to the part of the post that corresponds to where the <!–more–> tag was placed. I didn’t like this (especially the anchor link) so went into the source code and hacked it - then thought, hey why not just write a plugin to do it? So here we are - my first plugin!
After activating the plugin, you should be able to find the “More Link” tab under “Options” in the admin page. This plugin will let you change the text that is displayed. You can either just show plaintext, or also include the post’s title in the link by using [TITLE]. If you choose to include the title in the link you have a couple more options:
- Leave the title as is
- Limit the title to x characters
- Limit the title to x words (maximum of 99 words)
- Add ellipsis (…) to the end of the title if it has been cut off (used with 2 and 3)
For the link text you can use some basic HTML (bold, italic, underline) and also special characters. The last option is you can choose to remove the anchor link, so when the link is clicked it will show the beginning of the post and not the middle.
Examples:
Let’s use two random post titles as examples:
- answer to life the universe and everything
- forty two
Custom Link Text: » To read or not to read…
- » To read or not to read…
- » To read or not to read…
Custom Link Text: Continue reading <i>”[TITLE]“</i>
(options chosen: max of 3 words, including ellipsis)
- Continue reading “answer to life…”
- Continue reading “forty two”
Custom Link Text: more of ‘[TITLE]‘ ⇒
(options chosen: max of 20 characters, not including ellipsis)
- more of ‘answer to life the u’ ⇒
- more of ‘forty two’ ⇒
If you have any ideas/suggestions for improvement or found any bugs please email me
Hope you like the plugin!
Looks very nice. I’ve been using “Less” on my site to get rid of the anchor link but I like that your plugin allows the link text to be changed.
Whoops… Small bug… Try entering a special character in the “Custom Link Text” box. I used “»”, the same character that is used in the default link, and ended up with some odd results.
The first time you save it displays correctly on the site but the admin section shows “»”. The next time you save the site displays “»” and the admin section displays “Ã�»”.
Hi Jason,
I’ll try and see if I can fix it up though!
Just wondering did you enter ‘»’ or did you enter ‘»’ ? At the moment it should work if you enter ‘»’ but I do believe it acts strangely when you just enter the character as you see it
Nice to know you like the plugin
hi… I just tried it, but can’t get it to work. What version of Wordpress is needed?
I use Wordpress 2.0.x because my host doesn’t support PHP5 (bummer!).
@pyko,
I had been entering the character itself. I just tried the entity now and it works fine. Thanks for the help.
@Matt
I’ve only tried it on WordPress 2.2.1 and 2.2.2 so don’t know if the plugin will work on 2.0.x - sorry! I did have a quick look at the difference between PHP4 and PHP5 and it seems like I haven’t used anything that is PHP5 only…
When I find some spare time I’m going to get the older versions of WordPress and test out the plugin - then I’ll get back to you
@Jason
Nice to know it worked out! I did try to see if I could tweak it so you could enter the character as is, but didn’t quite work (and makes the code quite ugly). So unless I find a nicer solution, I’ll probably leave it as is, since the link will likely only have 1 or 2 special characters.
i beleive that the plugin is realy cool, but why doesnt convert all posts on my blog and only on someones?
i have the following :
http://www.mydomain.com/hotels/design-hotels/americas-design-hotels/page/3/ the Condesa df is still on read more>> but all the others are realy work nice.
If you can give me a tip? please do!
Hi Lazaros,
I’ve had a look at your site, I believe you mean:
http://www.luxury-global-hotels.com/hotels/design-hotels/americas-design-hotels/page/3/
instead of the link you put above?
And the Condesa post seems to look fine to me, it has:
more about : Condesadf Hotel, Mexico Design Hip Hotel, Mexico Design Hotels
Maybe try refreshing your page - see if that works?
As for the compatibility issues…it works with WordPress 2.3, but still haven’t found time to check if it works with earlier versions of WordPress. I’ve downloaded a couple and will keep you guys updated once I’ve tested them
yes yes yes! Thankyou! I had been looking head over heels through loads of the WordPress files trying to remove that stupid anchor link jump! Good job man you saved me many hours of playing around no doubt!!
Hello Pyko,
I’m using the Less plugin for years now. Yours also looks very good, but I was wondering if it could be made even better :)…
Could the more-text be altered on a post to post basis?
Sometimes I have something behind the that requires ‘Read more’ text to be displayed. Sometimes though it would be better to display ‘Look her for more examples’ or ‘Do you want to know why?’ or ‘Click for a complete list’ etc. etc.
What would be great is a new field in the write section somewhere beneath the post/tag textarea which says ‘More text’. If left blank it should display the standard text you’ve give in the options screen, but in the ‘write post’ screen you could overwrite this with a custom text.
What do you think? Could this be done? Personally I think this would make a great plugin, but I’m not a programmer :(…
Aaah, I thought this would allow me to change the actual url to point, for instance, to another web site rather than the auto-permalink … is there an option for this?
What I was suggesting is already possible… I just found out, after using WP for five years!!!
http://codex.wordpress.org/Customizing_the_Read_More
hi. Thanks for plugin
perfect.
regards
htmlentities() messes up UTF-8 text.
Using htmlspecialchars() instead helped.