Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Here is my code so far:

$terms = wp_get_post_terms($event->ID, 'speakers', array("fields" => "all"));
print_r($terms);

It displays this:

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 
   ) 
) 

How can I echo just name and description?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Well to print each term you could loop through each object and echo the name and description

foreach ($terms as $theterm) {    
    echo $theterm->name . " " . $theterm->description;
}

Is this what you are looking for?

[EDIT] Updated the answer

share|improve this answer
    
Yes. But one more thing. If I use the foreach loop, it will display as: NAME NAME DESCRIPTION DESCRIPTION. I need it to be NAME DESCRIPTION NAME DESCRIPTION. Any idea how to do that? –  user1526570 Sep 5 '13 at 10:31
    
I only added the <p> tags for the sake of output, the above should do what you need –  thirdOctet Sep 5 '13 at 10:35
    
Thanks for this. My mind is out of place right now. The answer was so simple. Thanks!! –  user1526570 Sep 5 '13 at 10:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.