Skip Navigation

[Resolved] CPT and "meta" tag

This support ticket is created 6 years, 10 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 6 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#611538

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?

#611661

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/

#611745

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?

#612046

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

#612669

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?

#613099

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.