How can I customize the_content(); output? [closed]
You can add a filter to the content directly on functions.php and use str_replace or perhaps some preg_replace (regex) to change the output of the content. Not tested. Try something like this: function add_class_to_img_and_p_in_content($content) { $pattern =”/<img(.*?)class=\”(.*?)\”(.*?)>/i”; $replacement=”<img$1class=”$2 newclass newclasstwo”$3>”; $content = preg_replace($pattern, $replacement, $content); $pattern =”/<p(.*?)class=\”(.*?)\”(.*?)>/i”; $replacement=”<p$1class=”$2 newclass newclasstwo”$3>”; $content = preg_replace($pattern, $replacement, $content); … Read more