php - Automatic highlight code in a wordpress blog -
I have an automatically-installed WordPress blog that is full of Python snippets and I want to highlight them (source code Colour) . I tried to install some plugins, but they need to edit all my posts that add some ethers to the pre-tags.
Do I have to pre-tag the plugins or other plugins in WordPress?
You can create a simple plugin that will register "filter". This filter will apply to all your posts:
function enhance_pre_tag_filter ($ content) {$ content = preg_replace ('/ / lt; pre & gt; /', '& lt; pre python_tags & Gt; ', $ content); Return $ content; } Foreach (array '(the_content', 'the_title', 'comment_text') as $ filter) add_filter ($ filter, 'enhance_pre_tag_filter', 9);
Comments
Post a Comment