September 14, 201214 yr Hi guys, I have what seems to be a very simple issue but have began tearing my hair out. Hoping someone here can help. The background: I have Taxonomies set up to cater for Events. Events being the parent taxonomy, then music, then indie. Events Music Indie I then have a menu set up with Events being the parent link with a drop down of Music coming when hovered. When Events is clicked and you are directed to the Events page, the events tagged in 'Indie' displays as intended because it is under events with all the relevant information. The ONLY thing I cannot get to display is the posts taxonomy name which in this case is 'Indie'. I can only get the current taxonomy name to be displayed which is 'Events' The goal is to have the most specific taxonomy displayed so that when I have further categories ('pop', 'house' etc) I would like the respective category name to be displayed on the post when viewed in the more general 'Events' category. Really hope I've explained this as best I can. Thanks in advance.
September 17, 201214 yr Within the loop that spits out the post? $terms = get_the_terms($post->ID, 'events'); That'll give you an array, pull out the appropriate $terms['name'].
September 18, 201214 yr Within the loop that spits out the post? $terms = get_the_terms($post->ID, 'events'); That'll give you an array, pull out the appropriate $terms['name']. Thank you very much kind sir. I had already tried this function but only until you prompted me to try it again did I realise that I had the wrong Taxonomy name due to me having to use the one built in with the Events Calendar plugin. For anyone who needs to use this with the Events Calendar plugin, use: $terms = get_the_terms(get_the_ID(), TribeEvents::TAXONOMY);
Create an account or sign in to comment