以下是我目前的代码:
$terms = wp_get_post_terms($event->ID, \'speakers\', array("fields" => "all"));
print_r($terms);
它显示以下内容:
Array (
[0] => stdClass Object (
[term_id] => 64
[name] => Apostle Dr. N Suppaya
[slug] => apostle-dr-n-suppaya
[term_group] => 0
[term_taxonomy_id] => 64
[taxonomy] => speakers
[description] => Apostle Dr. N Suppaya, God called him to the ministry, anointed him and told him to bring love, joy and peace of Jesus Christ to the world. In 1986, Apostle Suppaya received the Apostolic calling from God when God told him to build a Church which will be an instrument in building the Kingdom of God through evangelism and missions to the unsaved. This gave the birth to Jesus Lives Church. God has been blessing him with great miracles to testify the glory of God through his ministerial exposures.
[parent] => 0
[count] => 2 )
[1] => stdClass Object (
[term_id] => 61
[name] => Pastor Lynette Teo
[slug] => ps-lynette-teo
[term_group] => 0
[term_taxonomy_id] => 61
[taxonomy] => speakers
[description] => Pastor Lynette Teo graduated from RHEMA Bible Training Centre Singapore is married to Kevin and both are currently instructors at RBTCS, with a strong passion to teach and equip believers in Singapore and Asia in order to further God’s purposes and plans in advancing His Kingdom. They have also ministered in bible schools and churches in various parts of Asia including Malaysia, Indonesia, Thailand and Myanmar. They serve as leaders in their local church and are actively involved in areas of mentoring and discipleship. Lynette also serves in the prayer as well as worship ministries.
[parent] => 0
[count] => 1
)
)
我怎样才能呼应名称和描述?
最合适的回答,由SO网友:jhussey 整理而成
要打印每个术语,可以循环遍历每个对象并回显名称和描述
foreach ($terms as $theterm) {
echo $theterm->name . " " . $theterm->description;
}
这就是你要找的吗?
[编辑]更新了答案