简体   繁体   中英

Wordpress Theme Activation returns an error

I installed a wordpress theme but i get this error when I activate the theme. I don't know where the problem is. Parse error: syntax error, unexpected T_FUNCTION in /home/content/64/7418064/html/sites/directory/wp-content/themes/directorys/framework/page-tamer/class-page-tamer.php on line 782

Here is the code extract from that particular file

    public function parse_shortcode_content($shortcode) {

    Page_Tamer::$pattern = get_shortcode_regex();

    $shortcode_content = preg_replace_callback(
        "/" . Page_Tamer::$pattern . "/s",
        function ($matches) {
            return $matches[5];
        },
        $shortcode
    );

    return $shortcode_content;
}

The line in question is function ($matches) {

Can somebody please help me, I will greatly appreciate it. Thanks

There is anonymous function. Their support is available with PHP 5.3 and higher. Perhaps it will help:

    function code_connect($matches) {
            return $matches[5];
        }
$shortcode_content = preg_replace_callback("/" . Page_Tamer::$pattern . "/s", 'code_connect', $shortcode);

This will create a function (code_connect) in the usual way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM