Skip Navigation

[Resolved] Add CPT between tags

This support ticket is created 4 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 4 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#1584333

I want that some data appears between <head></head> tags. I want to create a CPT to add this information via Toolset, but it needs to be between <head></head> tags (not <body></body>).
Here is an example of the data:

<script type="application/ld+json">
{
"address":
{
"@type": "PostalAddress",
"streetAddress": " Benito Juárez s/n",
"postalCode": "03300",
"addressLocality": " Hueytamalco",
"addressRegion": " Puebla",
"addressCountry": "Mexico"
}
}
</script>

#1585091

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no native way that should affect the content within your head tags.

However - the only thing I can offer is Toolset offers Types Fields API PHP function using which you can access the custom field value. Basically, you can use the function types_render_field() to get the custom post field value.

More info:
=> https://toolset.com/documentation/customizing-sites-using-php/functions/
=> https://toolset.com/documentation/customizing-sites-using-php/loading-wordpress-content-database/

You should try to use above information to get the custom field value and build your JSON object.

#1586081

Thanks Minesh.

Pityfully I'm not a programmer. I like Toolset because I can made "almost" anything I need without programming. Finnaly I found this "almost" I can't do.

Thanks

#1586407

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - you can say this is a limitation of Toolset or you must have Pro programming knowledge to achieve this.

As Toolset plugins will have effect on content (body) area, there is no way to update the Head tag without custom programming.

If you want custom programming for your project, I suggest you should contact our certified partners:
=> https://toolset.com/contractors/

#1587173

Well, no matter how good is a plugin, there will always have specific things it won't achieve. And a programmer will be needed.
Thanks for your suggestion. I'm trying a workaround that may work.

As a suggestion: won't it be interesting for Toolset to include a feature like the one I mentioned? Is not the first time I have to include something into the <head> tags. Until now it was always static content sitewide, so I could achieve it through my theme (Divi). This time I need to include dynamic content, and for this Toolset was the logical option: create a CPT and insert it. The unexpected issue is the area: <head> or <body>.

Maybe you could consider it for the future.

Best,

Antonio

#1587815

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I understand.

You can always file a new feature request using the following link in front of our product manager and they will happy to review it.
=> https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/