Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
1  
Afaik, <!--more--> is no shortcode. Anyway: You can trigger shortcodes by code. –  kaiser Mar 13 '12 at 3:34

1 Answer 1

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

 
discard

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.