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.

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

share|improve this question

3 Answers 3

up vote 1 down vote accepted

k i found the answer on researching and modifying a code i found :

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,,';
}

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

share|improve this answer

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;
}

add_filter('the_tags','add_my_code_after_tags');
share|improve this answer
    
will it work after more tag placement within the post ? single.php ... –  Ayaz Malik Feb 2 '11 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.
http://codex.wordpress.org/Customizing_the_Read_More
http://justintadlock.com/archives/2009/07/01/how-to-filter-a-wordpress-themes-more-link-text

Hope that helps.. :)

share|improve this answer
    
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 Feb 2 '11 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 Feb 2 '11 at 16:42
    
in my question i mentioned to work within the post page –  Ayaz Malik Feb 2 '11 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 Feb 2 '11 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 Feb 2 '11 at 18:07

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.