I am trying to: Create the PHP equivalent to this shortcode generated by Types 1.9
[wpv-taxonomy-field name="family"]
It's for a taxonomy field I created using Types 1.9. I'd like to use PHP code instead of the shortcode.
Please provide the equivalent PHP statement.
Thanks
Thank you for contacting Toolset support, I'd be delighted to assist!
This shortcode is actually registered in Views, I cannot share the code here as it's a paid plugin..
Another way is to use get_term_meta, such as get_term_meta( $term_id, 'feature-group', true );
This can help: hidden link
You can easily find how our shortcodes are registered by performing a project wide search in tools such as Atom, for example searching the Views plugin.
Note that this shortcode is inside the filename "wpv-deprecated.php" so I'm not sure if it'll be going away soon.
I hope this helps!
Hi
Your answer doesn't make any sense to me. First of all, there is nothing proprietary about querying data from WordPress. So I don't know why you believe there is something proprietary about how you query WordPress in your shortcodes and cannot reveal it here.
Second, the actual shortcode code is in the "wpv-shortcodes.php", it's only referenced in "wpv-deprecated.php".
Third, your code is using the same "get_term_meta" you told me to use as per that article, which I have already tried.
My reason for asking for support is that Toolset sometimes adds things to field names, for example it does that when you create a custom field, it appends wpv or something similar to the field name.
When I was not able to access this data with "get_term_meta" I suspected that something similar was going on. Maybe when I created that field it somehow put it into a group or appended something to the name.
Please pass my question onto Caridad if she is still available. I still need help with this. Or Juan if he is available.
Thanks
Hello there!
The shortcode is only referenced in the code of the Views plugin, which is a paid product and code cannot be posted publicly. My Tier 2 recommended that I share the get_post_meta option as the best solution.
As Caridad is no longer with us, I have sent this over to Juan for you custom coding project. Thank you for your patience!
Thanks for sending it to Juan. I took a closer look at the shortcode code itself and it does look like something is getting appended to the field name.
It looks like it is appending "wpv-taxonomy-field-meta-" to the field name, but it will be better if Juan can provide an example of how to query a Types-created taxonomy field name using PHP.
Hello,
I’m not Juan but I'll try to help you. I'm Adriano, Toolset support lead and I have been escalated to this thread. I’ll give my best to help you to achieve your needs through Toolset components.
Where you want to insert that PHP code? Archive page?
Hi Adriano
Thanks, but I did work it out by myself. I found that Types adds a prefix to each field name you create so a field named "account-status" is actually written to the database as "wpcf-account-status".
Once I realized this I was able to use code like this to get the values I needed.
$vendorstatus = get_term_meta( $vendorid, 'wpcf-account-status', true );
Great, thanks for sharing!