Pages

Thursday, October 11, 2012

Wordpress Create Plugin with sortcode

/*Sortcode Display*/
    function Test_Plugin_name($content) {
        if (strpos($content, '[JayMap]') !== FALSE) {
            $qaform = "jaydeep";
            /*
                if you want to replace it with html entites than use below code
                $content = preg_replace('/<p>\s*<!–(.*)–>\s*<\/p>/i', "<!–$1–>", $content);
            */
            $content = str_replace('[JayMap]', $qaform, $content);
        }
        return $content;
    }
    add_filter('the_content', 'Test_Plugin_name');
    add_filter('widget_text', 'Test_Plugin_name');
    /*Sortcode Display*/

No comments: