How can I change the HTML of the_content?
-
I know the basics of how to add a filter to modify the_content, but I want to modify the HTML in detail. Specifically, I want to find any blockquote elements and add some HTML within them. This is what I have so far;
function modify_content($content) { if( is_singular() && is_main_query() ) { //Wrap the content in a div $content = "<div id='wrapper'>" . $content . "</div>"; return $content; } add_filter( 'the_content', 'modify_content' );
What’s the best way to go about modifying the HTML? Someone mentioned this; https://www.php.net/manual/en/book.dom.php
Is there a better way?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How can I change the HTML of the_content?’ is closed to new replies.