There is plenty of information on how to make the Read More function display different text in the Codex but what kind of filter would need to be used to make it display <button class="readmorebtn" onclick(permalink)>Read More</button>
?
Leave a Reply
You must be logged in to post a comment.
The “(more…)” link gets filtered through
the_content_more_link
inget_the_content()
. You can hook into this function and let it return whatever you want.Short answer: You don’t.
Longer, more useful answer: What you need to do is hook in to the
the_content_more_link
filter and change the simple link into a style-able element that looks like a button. The theme I use on my site already does this. It turns my read more link into:You can see the regular read more link buried in the middle. The various
<div>
s and<span>
s around it help to style the link so that it appears as a solid gray button:So if you want to style your link to look like a button, this is the path to take. As @sorich87 stated in the comments, the
<button>
tag is meant to be used inside forms. So if you use a<button>
tag for your read more link, you’ll face the following issues:<button>
and either strip out the link or thrown an error while looking for the rest of the form).<!--more-->
tag inside the body of a form. You can say “I won’t do that” now, but accidents are accidents and it might still happen … then weirdness and chaos will ensue.