Code Snippet > PHP
How to Insert Code after More Tag within WordPress Post Page
This Simple tutorial will show you how to add/insert code or advertisement etc. right after the
PHP
This code will replace the with your ad added above in my_ad() Function
add_filter('the_content', 'adds_block');
function adds_block($content){
if (is_single())
global $post;
$thePostID = $post->ID; // getting the post ID
$new_insert = '<span id="more-' .$thePostID.'"></span>' ;
return str_replace($new_insert, my_ad(), $content);
}
function my_ad(){
return ' Your Ad Code '; // What you want to display in place of the more tag. can be a custom code, advertisement etc.
}
Source: http://www.designzzz.com/how-to-insert-code-after-more-tag-in-post-page/
Leave a comment
Have something to say? Drop a comment! No HTML tags are allowed in the comment textfield.





















0 comments