WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
Afaik, <!--more--> is no shortcode. Anyway: You can trigger shortcodes by code. – kaiser Mar 13 '12 at 3:34
up vote 2 down vote accepted

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.

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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