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
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 asked Feb 1, 2011 at 14:36 Ayaz MalikAyaz Malik 3021 gold badge8 silver badges24 bronze badges3 Answers
Reset to default 2This 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;
}
add_filter('the_tags','add_my_code_after_tags');
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/Customizing_the_Read_More
http://justintadlock/archives/2009/07/01/how-to-filter-a-wordpress-themes-more-link-text
Hope that helps.. :)