Dear Sir/Madam,
I have a custom post type and custom categories and tags, I refer to the function wp_get_post_tags() but it doesn't support the custom tags, how can I get the list of tags belong to the post if I have the post id?
Best regards,
Kelvin.
Hi there,
Toolset uses standard WordPress taxonomies when you add them via the Toolset options. It should work with the normal WordPress functions, but just to let you know there is a shortcode that you can utilize to retrieve the list of taxonomies.
For more information:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153472
In the shortcode ITEM attribute you can provide your Post ID, for more information:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
Thanks.
Dear Christopher,
Can I use the shortcode to get specific post's category?
My custom taxonomies is healthqa-tag, I want to do
echo do_shortcode('[wpv-post-taxonomy type="healthqa-tag" separator=", " format="link" show="name" order="asc"]');
but for specific post.
Best regards,
Kelvin
Dear Christopher,
I finally fix my requirement but still need your help.
global $post;
$post = get_post( $_REQUEST['p'], OBJECT );
setup_postdata( $post );
echo do_shortcode('[wpv-post-taxonomy type="healthqa-tag" separator=", " format="name" show="name" order="asc"]');
wp_reset_postdata();
I want to add custom style to each taxonomy, for example
<span class="mytags"> .... </span>
Hi there,
Unfortunately, it is not possible to add HTML instead of the separator in the shortcode.
It is possible to do custom PHP coding for that which is outside of our support scope. I will try to describe what will be the steps but we will not be able to code it for you.
You can create a custom shortcode:
https://toolset.com/documentation/programmer-reference/adding-custom-code/how-to-create-a-custom-shortcode/
Which you can retrieve the tags using the wpv shortcode there.
Then you can split the comma separated list to a PHP array:
hidden link
After that you can add your HTML code to each member of the array and mis all in a string:
hidden link
Now you can echo that string which will contain the formatted list.
Then youc an use that custom shortcode in the View instead of the wpv shortcode.
Thanks.