I am developing a wordpress plugin using OOPS concept with classes. I want to use namespace in them. Does anyone has any idea how to implement that in my plugin ? Thanks
1条回答 默认 最新
- douyu0725 2019-01-11 05:49关注
Please define namespace with first line and use like we do it below.
<?php namespace Appsense\popop; class shortcode{ public function gernerateShortcode(){ add_shortcode('appsense_popop',array('Appsense\popop\shortcode','popop_shortcode')); } public function popop_shortcode(){ $output = "Hello world!"; return $output; } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报