Home › Forums › Calendar Products › Events Calendar PRO › Custom Icon for Events Category
- This topic has 4 replies, 2 voices, and was last updated 8 years, 11 months ago by Brian.
-
AuthorPosts
-
May 9, 2015 at 1:34 am #961604CarlParticipant
Hey Team,
I am trying to have a custom icon for individual Events category, in the advanced custom field i have assigned a text field to “Taxonomy Term to Event Category” so now on the events category section i can paste the image url to the category, now on calling the image the custom field cannot get the individual category. this is what i have done
$categoryicon = get_field(‘icon-media-link’, ‘tribe_events_cat_’.$term_id);
” />
but its not returning any value,
But to display the category name this works
$events_cats = get_the_terms($id, ‘tribe_events_cat’);
<h3 class=”evnts-category”><?php foreach($events_cats as $i) {
echo $cat_titles[] = $i->name;
} ?></h3>please advice me how can i display an image assigned to the individual category.
Thank you
May 11, 2015 at 5:53 am #961751BrianKeymasterHi,
Thanks for the interest in our plugins. I can try to help out, but I am limited in supporting customizations.
That is from Advanced Custom Fields:
$categoryicon = get_field(‘icon-media-link’, ‘tribe_events_cat_’.$term_id);
However, the only thing that sticks out to me is where is the $term_id variable coming from?
Does that have a value? That maybe the issue.
I can try to help out some more, but again I am limited in supporting customizations and cannot troubleshoot each step.
Cheers
May 11, 2015 at 8:29 pm #962029CarlParticipantHey Brian,
Really appreciate you taking out time to reply :).
The value i am getting from is
$terms = get_the_terms($id, ‘tribe_events_cat’);
$term_id = $term -> term_id;The above code returns the term id of the post type registered with normal wordpress codex procedure.
but some how it does not return us the id of the tribe events category, as we presume it is a custom taxonomy of Event Post Type.
Is there a better solution to get id of single category term of Tribe Events in order to assign a custom icon.
Regards
May 12, 2015 at 5:48 am #962075BrianKeymasterI think that is the best way to get the id of a single category.
However, this
tribe_events_cat_’.$term_id
will not correctly combine the string (tribe_events_cat_) with the id.
Look at the solution here:
http://stackoverflow.com/a/11740277
And see how it combines the word “check” with a variable. That is similar to how you need to do it.
June 22, 2015 at 2:14 pm #971974BrianKeymasterSince there is has not been any activity on this thread for over 2 weeks so I am now closing it. Feel free to start a new thread if you have further issues. Thanks! 🙂
-
AuthorPosts
- The topic ‘Custom Icon for Events Category’ is closed to new replies.