php - regular expression to convert WordPress tags to HTML -


I have this HTML that I am reading in WordPress from a regular PHP file. This is not a valid HTML but WordPress should take IMG tag to exclude [caption] and it will be sent to a & lt; P & gt; Put in the caption as tag. But I do not want any such word in PHP. [/ Caption] [/ caption] [caption id = "" align = "alignnone" width = "190" caption = "my caption"] html image tag found here but stripped [/ caption]

How would you do it in regular expressions? I'm thinking of using preg_match_callback in some way.

It seems that the WordPress code works just for you to include plug.php and wp-two things There are shortcodes.php from directory.

  requires 'wordpress / wp-include / plugin.php'; 'Wordpress / wp-included / shortcodes.php' is required; Add_shortcode ('caption', 'hand caption'); $ Content = '[Caption ID = "EFU" style = "bar"] Mary had a little lamb [/ caption] whose wool was white like snow; Do_shortcode ($ content); Function Definition ($ attributes, $ content = '') {var_dump ($ attributes, $ content); }  

print

  array (2) {["id"] = & gt; String (3) "foo" ["style"] = & gt; String (3) "bar"} string (23) "Mary had a small Lamb"  

Comments

Popular posts from this blog

MySql variables and php -

c# - How can I find out if there are windows above a control? -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -