Simulate shortcodes with javascript

I found out that [shortcode] are not showed in the post excerpts, so I was thinking about a workaround with javascript: keep the notation [shortcode], deleting its definition, and finally add a javascript which replace it with the html code of the original shortcode definition.

Say we have the following shortcode

add_shortcode( ‘VF’, ‘vf_sc’ );
function vf_sc( $atts ){
return “<span class=boxed><b><font color=00CD00>V</font>|<font color=red>F</font></b></span>”;
}

with boxed defined as

.boxed {
padding: 0 5px;
border: black 0.7px solid;
}

is it possibile to write a javascript which replaces the string [VF] with V|F ?

So that even by deleting the definition of the shortcode, I can still write [VF] in the editor and keep the same output.

Read more here:: Simulate shortcodes with javascript

Leave a Reply

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