Skip Navigation

[Resolved] Custom Shortcode for Taxonomy Name

This thread is resolved. Here is a description of the problem and solution.

Problem:
Custom Shortcode for Taxonomy Name

Solution:
You need custom shortcode in order to display taxonomy name from eventon plugin.

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/custom-shortcode-for-taxonomy-name/#post-1120696

Relevant Documentation:

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Tom Gonzales 6 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1120078

I am trying to: Create a custom shortcode to pull a taxonomy name into a View loop. Minesh recently helped me by correcting a shortcode to pull in term-meta data for location address, but when I tried modifying the code in a new shortcode to pull the event location/venue name, it's not working.

Link to a page where the issue can be seen: hidden link

I expected to see: I created the following shortcode, based on a previous shortcode used to pull in term-meta data for the location address (which Minesh previously helped me with - thanks!), but it's not working, so I was hoping Minesh could take a look and point me in the right direction:

// Get Location Name
function location_name_func( $atts ) {
global $post;

$term_ids = wp_get_object_terms( $post->ID, 'event_location', array( "fields" => "ids" ) );
if(is_array($term_ids)) {
$location_name=evo_get_term_meta($tax, $term_id);
return $location_name['location_name'];
}

}
add_shortcode( 'show_location_name', 'location_name_func' );

Instead, I got: Here's are the results I'm getting so far:

hidden link

And here is a link to documentation on the plugin:

hidden link

I already set up access via an admin account for Minesh, which is still active.

Any help would be much appreciated.

#1120181

I've also tried this version of coding to create the shortcode, but it's not working either:

// Get Location Name
function func_get_taxonomy_name( $atts ) {
global $post;

$term_ids = wp_get_object_terms( $post->ID, 'event_location', array( "fields" => "ids" ) );
if(is_array($term_id)) {
// $locations = get_term_meta($term_ids[0]);
$locations=evo_get_term_meta($tax, $term_ids[0]);
return $locations['$tax'];
}

}
add_shortcode( 'show_location_name', 'func_get_taxonomy_name' );

And I tried inserting the taxonomy using the Fields and View button in the Views admin panel and selecting the Event Location option under the taxonomy section and selected it to display the name, but that doesn't work either.

#1120696

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - your shortcode were not correct.

I've added another shortcode at the following location:
=> hidden link

And I can see it's working just fine:
=> hidden link

Could you please confirm.

#1120965

My issue is resolved now. And BTW...you guys provide some of the best support for paid WordPress software solutions. Thank you!