Hi,
I'd like to use "meta" tag in a page head section. The value of the tag would come from CTP. Would you suggest any approach to accomplish that?
Hello,
I suggest you create a custom flat taxonomy "my-meta", and register it to your CPT:
https://toolset.com/documentation/user-guides/create-custom-taxonomies/
Then you will be able to add/setup "my-meta" terms for each post, then in the page head section, render the "my-meta" terms value with Views shortcode [wpv-post-taxonomy]
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy
If it need PHP codes, you can try the wordpress function get_the_terms():
https://developer.wordpress.org/reference/functions/get_the_terms/
Dear Luo,
1. displaying taxonomy would be only partial solution, I would need CTP values. I understand this shouldn't make any difference?
2. how to use views to display, taxonomy or whatever, in a page head section?
Q1) I would need CTP values. I understand this shouldn't make any difference?
I assume you are going to display other custom fields of current single post, if it is a custom field created with Types plugin, please try Types shortcode [types] and function types_render_field():
https://toolset.com/documentation/customizing-sites-using-php/functions/
Q2) how to use views to display, taxonomy or whatever, in a page head section?
What is the "page head section"? if it is outside the post content area, then you will need to find and edit theme file, which is for rendering the single post,
https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
use PHP codes to output what you want, if you need to output a view, please try with Views function render_view()
https://toolset.com/documentation/programmer-reference/views-api/#render_view
Dear Luo,
thanks, I will see these references. What I mean is <meta> tags within <head> section.
BWT, do you know whether Yoast SEO can display Toolset CTP within meta tags?
For the new question:
do you know whether Yoast SEO can display Toolset CTP within meta tags?
I searched it in our forum, and found this similar thread:
https://toolset.com/forums/topic/yoast-seo-%CF_-doesnt-work-with-custom-field/
For your reference.
If you still need assistance for it, please create a new thread for the new question, that will help other users to find the answers.