Hey, is it possible that i can put a chunk of code somewhere and it will show up after the more tag seperator but within the post ?

I mean if i put more seperator after first paragraph then on post areas after that will show up the code i will put.. probably some html with a twitter and rss link.

Help is appreicated :) cheers Ayaz

3 Answers 3


This will add your code after the more tag area on the post page:

add_filter('the_content', 'adds_block');

function adds_block($content) {
    if (is_single()) {
        // return $content;
        global $post;
        $thePostID = $post->ID;
        $test = '<span id="more-' .$thePostID.'"></span>';
        return str_replace($test, ads(), $content);

function ads(){
    return 'Your Custom Code,,';

You can use the_tags hook to add your code to the tags output like this:

function add_my_code_after_tags($tags){
  $my_code =$tags . "your output here";
  return $my_code;

  • will it work after more tag placement within the post ? single.php ...
    – Ayaz Malik
    Commented Feb 2, 2011 at 16:28

A filter on the_content_more_link may be appropriate for you, the filter should give you full control over the more link, so you could essentially add to it, remove it, or pre/ap-pend some extra content.

Here's an example, uncomment the appropriate line to prepend or append(ie. place extra content before or after the link).

add_filter( 'the_content_more_link', 'custom_more_link', 1000 );

function custom_more_link( $more_link ) {

    $extra_more = '<br />My more link extra content';

    // Uncomment line below to prepend content
    //return $extra_more . $more_link;

    // Uncomment line below to append content
    //return $more_link . $extra_more;

NOTE: The extra content must be stored inside the variable returned.

Further reading/examples.

Hope that helps.. :)

  • but in this case wudn't it show on homepage or other pages which have more button available right ?, i wanted to make the area visible with in the post (single.php)
    – Ayaz Malik
    Commented Feb 2, 2011 at 16:27
  • It should work on the home page(if your theme calls the_content and not the_excerpt), but naturally not on a single post page(the more link is not shown there).
    – t31os
    Commented Feb 2, 2011 at 16:42
  • in my question i mentioned to work within the post page
    – Ayaz Malik
    Commented Feb 2, 2011 at 16:55
  • 1
    That's not how it reads, but i'll take your word on it being what you meant.. ;) Then really what you need is a shortcode that inserts the button in the relevant place, i'd suggest a read of the following: smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes
    – t31os
    Commented Feb 2, 2011 at 17:51
  • sorry my bad english , its not what i ws looking for becuase everything i would have to include a shortcode after more tag in the post editor, but it can do that work. So its not possible to just work on some function which will automatically put some text/code after the more tag in the post page ?
    – Ayaz Malik
    Commented Feb 2, 2011 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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