function new_excerpt_more($more) {
global $post;
return '<a href="'. get_permalink($post->ID) . '" id="whatever">Read the Rest...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
You can see more here.
Thread Starter
Sinopa
(@sinopa)
Oh. Forgot to add that I use the_content, and not excerpt.
what is the purpose of adding a css id to the more link?
– the link can be perfectly styled based on the css class .more-link
;
– using more than one post with this link on one web page would output multiple elements with the same css id, i.e. create invalid code.
unless MYMORESTYLE
is unique per post, in which case the next question is, where would it come from?
Thread Starter
Sinopa
(@sinopa)
I’m sorry alchymyth, but I just need it without using a lot of time explaining why I need it.
does it need to be unique per post?
Thread Starter
Sinopa
(@sinopa)
That part I have fixed. I just need to add an id=”” to the read more tag
Thread Starter
Sinopa
(@sinopa)
*LOL* Ask and ye will receive a thousand questions in return, but ye will not receive an answer 😀
try this filter function:
add_filter( 'the_content_more_link','more_link_css_id',10,2);
function more_link_css_id($link,$link_text) {
global $post;
$link = '<a href="' . get_permalink($post->ID) . "#more-{$post->ID}\" class=\"more-link\" id=\"more-link-id-{$post->ID}\">$link_text</a>";
return $link;
}
this example would add the css id #more-link-id-123
Thread Starter
Sinopa
(@sinopa)
Thank you very much alchymyth 🙂
I will try it right away 🙂
Thread Starter
Sinopa
(@sinopa)
OMG! It worked! Thank you, Thank you, Thank you alchymyth 🙂
Been trying to find a solution on Google, but didn’t find any.
Thank again alchymyth. You saved my day 🙂