不允许在wordpress插件中调用其他函数内的函数?

时间:2018-05-19 21:20:55

标签: php wordpress

我很难让这个小插件运行。

function latest_price(){
global $wpdb;
$result = $wpdb->get_results("SELECT bid,ask FROM wp_ticker ORDER BY indate DESC limit 1");

$price = $result[0]->bid;
return $price;
}

 function outputprice(){
 $output = $this->latest_price();
echo $output;
}


add_shortcode ('getprice', 'outputprice');

当我尝试在wordpress页面上运行此短代码时,页面不会加载。当我打开调试时,我没有看到任何错误? 这种结构是允许的还是应该使用OOP并将函数放在类中?

0 个答案:

没有答案