Thursday, 24 January 2019

How to convert pre attributed data to sourcecode attributed shortcode in Wordpress

In my Wordpress, I want to use GeSHi syntax highlighter. It required the content like:

[sourcecode language="php"] ... [/sourcecode]

But I don't want to use it in admin editor. Because in the editor, I want to stylize the code. For this I want to use it in the admin side like:

<pre class="pre-admin" data-language="php">...</pre>

I'm hoping to convert <pre class="pre-admin" data-language="php">...</pre> in the content of the post to [sourcecode language="php"] ... [/sourcecode] in my theme. But I have no idea.



from How to convert pre attributed data to sourcecode attributed shortcode in Wordpress

No comments:

Post a Comment