如何在方法,wordpress中发送参数

时间:2019-10-16 13:45:43

标签: php wordpress oop

我建立了一个类来管理项目中的所有短代码。我在方法中发送参数时遇到问题。

如何将参数发送到show_provider_map_callback()方法?

class shortcode_gomed
{

    public function __construct()
    {
        add_shortcode('show_provider_map', array($this, 'show_provider_map_callback'));
    }
    public function show_provider_map_callback()
    {
        ob_start();
        $provider_map = true;
        global $post;
        $meta = get_post_meta($post->ID);
        require(plugin_dir_path(__FILE__) . '/templates/core/map.php');
        return ob_get_clean();
    }
}

0 个答案:

没有答案