WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
EM ver 5 Beta 1 - Category ID Issue (5 posts)

  1. rontarson
    Member
    Posted 2 years ago #

    What am doing wrong on pulling category ID's in ver 5. Looks like this changed but not familiar enough to understand how to change it going forward.

    Here is what I had in EM ver 4

    global $EM_Category;
    $catname = $EM_Category->name; //get category name and store it
    $currentid = $EM_Category->id; //get and store the current category id

    $EM_Category->name; still pulls the category name but $EM_Category->id; does not pull the id.

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    Hi,

    try to use $EM_Category->term_id

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    yes, now EM_Category is basically an extension of the object you get when you do get_term(), with added methods for use in EM

    I'll make id = term_id just to avoid unecessary confusion in next beta, but if you can use term_id, better :=)

    similar concept in Event and Location objects, they should contain all post object fields alongside EM specific properties/methods.

  4. rontarson
    Member
    Posted 2 years ago #

    So to continue on the below should be modified to $EM_Event->term_id; but what about get_categories() and get_ids()? Are these being updated as well?

    if (class_exists('EM_Events')) {
    	$currentid = $EM_Event->id; //get and store the current event id
    	$cats = $EM_Event->get_categories(); //get the categories for the current event
    	$cat_ids = $cats->get_ids(); //get the ids for the categories of the current event
    	$cat_ids_strg = implode(',', $cat_ids); //make a comma separated string of category ids
  5. agelonwl
    Member
    Posted 2 years ago #

    @rontarson,

    get_categories() and get_ids() should be the same. Please advice if it doesn't work!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic