how can I add a <--more--> tag directly in the template? I mean, the exact php code to use in a template for that shortcode. I need it for a script that makes use of that shortcode to hide content and having to add the "more" shortcode by hand through all the posts would be such a task

any help appreciated!


The code would probably be something like this:

echo '<a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">".__( 'Read more &gt;', 'your-theme' ). '</a>';

Check out the source on how WordPress does it: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/post-template.php#L219

This has to be inside the loop to work and the $post global has to be visible in the current scope.

|improve this answer|||||
  • that's exactly what I ws looking for, many thanx!!! – Devin Mar 13 '12 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.