How to change style attribute of an element dynamically

How can I change a style in the content (without having to change the content in all my pages)?

To change all the <h3> tags to <h2>, add this code to your functions file or plugin:

[php]
<?php
function wpster_change_h3_to_h2($content) {
$content = preg_replace(‘/<h3(.*)>(.*)<\/h3>/’, ‘<h2$1>$2</h2>’, $content);
return $content;
}
add_filter(‘the_content’, ‘wpster_change_h3_to_h2’, 9999);
?>
[/php]

Submit a Comment

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