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

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -