Haroun
April 2, 2015 at 4:03 am
hi, i used the espresso get event categories
$event_categories = espresso_get_event_categories()
and i get an object of type (EE_Term)
in my case i can’t use do_shortcode function.
so (using php) how can i get the fields like the category name and id ?
this is the object that i get:
object(EE_Term)#322 (8) {
[“_props_n_values_provided_in_constructor”:”EE_Base_Class”:private]=>
array(4) {
[“term_id”]=>
string(2) “10”
[“name”]=>
string(7) “Parties”
[“slug”]=>
string(7) “parties”
[“term_group”]=>
string(1) “0”
}
[“_timezone”:protected]=>
string(14) “Africa/Abidjan”
[“_dt_frmt”:protected]=>
string(6) “F j, Y”
[“_tm_frmt”:protected]=>
string(5) “g:i a”
[“_cached_properties”:protected]=>
array(0) {
}
[“_model_relations”:protected]=>
array(2) {
[“Term_Taxonomy”]=>
array(0) {
}
[“Extra_Meta”]=>
array(0) {
}
}
[“_fields”:protected]=>
array(4) {
[“term_id”]=>
int(10)
[“name”]=>
string(7) “Parties”
[“slug”]=>
string(7) “parties”
[“term_group”]=>
int(0)
}
[“_Extra_Meta”:protected]=>
NULL
}
Dean
April 2, 2015 at 4:33 am
Add New Note to this Reply
Take a look at /wp-content/plugins/event-espresso-core-reg/core/db_classes/EE_Term.class.php
$name = $object_variable->name(); will get you the name.
There’s nothing specific for the ID, so you would likely ned to get the slug or name and then use get_term_by https://codex.wordpress.org/Function_Reference/get_term_by
Haroun
April 2, 2015 at 5:34 am
Add New Note to this Reply
Thank you so much mr Dean, that’s too helpful 🙂