I’m trying to add a div with certain content in every page of a wordpress.
For that I am trying to create a plugin that adds this div in a filter.
I’ve created the plugin, the function that modifies the content and the call to that filter with the hook “the_content”:
function add_content_filter($content){
$original_content = $content ; // preserve the original ...
$add_pre_content = '<p> This will be added before the content..</p> ' ;
$add_sur_content = '<p> This will be added after the content..</p> ' ;
$content = $add_pre_content . $original_content . $add_sur_content ;
// Returns the content.
return $content;
}
add_filter('the_content', 'add_content_filter');
For some reason, even with the plugin activated the content is not modified by the plugin. I used the code from:
How do wordpress plugins add content?
as a refference. Do I need to do something else in order to get the code working?
It’s solved, may be due to a change in the code not updated in the hosted plugin. It should work as it is written here.