How do I create a secondary version of the_content

I am trying to create a secondary/alternate version of the_content with some changes. This is the code I found to start with:-

function new_content($content) {
$content = str_replace(‘<img’,'<img class=”newImgclass”‘, $content);
$content = str_replace(‘<p>’,'<p class=”newPclass”>’, $content);
return $content;
}
add_filter(‘the_content’,’new_content’);

I want a version of new_content that doesn’t affect the original the_content that is when I echo new_content only, all the p have a class=”newPclass”. Right now, the changes are being applied to the_content.

Read more here:: How do I create a secondary version of the_content

Leave a Reply

Your email address will not be published. Required fields are marked *