Skip Navigation

[Resolved] Yoast primary taxonomy : displaying something else than the ID for CPT

This support ticket is created 5 years, 7 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 5 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#1226341

Tell us what you are trying to do?
Show Name instead of ID

Is there any documentation that you are following?
Following the thread: 'Yoast primary taxonomy : displaying something else than the ID' with Minesh.

What is the link to your site?
It's restricted

I added in the view: [wpv-post-field name='_yoast_wpseo_primary_wpdmcategory'] ... and it shows the ID of the primary category in WPDM = WordPress Document Manager. Sofar, so good.
But I want to show the name.

In functions.php I put the following code and tried to adapt it to the Custom Post Type of Document Manager:
function func_get_yoast_primary_category( $atts ) {
global $post;
$cat_id = get_post_meta($post->ID, '_yoast_wpseo_primary_wpdmcategory',true);
$term = get_term( $cat_id );
return $term->name;
}
add_shortcode( 'get_yoast_primary_wpdmcategory', 'func_get_yoast_primary_wpdmcategory' );

What is it I do wrong?

Greetings,
Charlotte

#1226630

Yoast is not a Toolset Product. It seems that you are achieving this display with Custom Code related to Yoast's API and WordPress API, and as such, it's not something we can do for you.

Usually, in a view displaying terms, all you need to do is insert a ShortCode to display the Term name:
[wpv-taxonomy-title]
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153462

Now, if you can link me to Minesh's thread and update me how this relates to Toolset and it's supported features as seen on our Support Policy (https://toolset.com/toolset-support-policy/) I might be able to have a look and tell what needs to change.
However looking at the Custom Code you outline, this is not something we support because it's not related to Toolset or it's API.

Solutions, in this case, can be to ask Yoast for assistance or the listed and trusted contractors here https://toolset.com/contractors/

Thank you!