How do I change the text content of a div for a comment validation error message?

if your above Javascript is working fine and you want to insert that into a page. Kindly add the following code to your functions.php. I have tested this code it’s working fine. function handle_comment_error() { ?> <script> document.getElementById(“comment-error”).innerHTML = “Please enter your comment.”; </script> <?php }add_action(‘wp_head’, ‘handle_comment_error’); Let me know if you face any issues.

Div not working in WordPress post

End-of-line has no meaning in HTML, except if it separates text, where it is taken as one blank. If WordPress is eliminating blank lines, it’s only optimizing your code. To add a blank line, use the HTML br Tag: <br> Or the more syntactically correct (but equivalent): <br/>

Ignoring links from the_excerpt

To strip the <a>…</a> tags from the output from the_excerpt(), you could use the the_excerpt filter and a regular expression search-and-replace. Updated: In response to a comment, I’ve updated the code—the regex specifically—to strip out <a>…</a> and <a><span>…</a></span> constructions. Updated again: In response to another comment, I’ve updated the code to use the get_the_excerpt filter, … Read more