Skip Navigation

[Resolved] Shortcodes of other plugins in custom Types fields

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 12 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 10 replies, has 2 voices.

Last updated by Beda 6 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#588593
1.jpg

Hello, my name is Cleyton and I have a problem.

I use the Toolset plugin to create custom fields and custom posts on my site.

I have a field in which I embed an embed video code.

Just that we changed our platform of videos and now in this field I need to put a shortcode of a plugin of videos of WordPress:

The video plugin is this: hidden link

When I'm going to include a new video, the plugin gives me a shortcode like this here:
[fwdevp preset_id="0" video_path="{source:'hidden link', label:'tesat', videoType:'normal', isPrivate:'no'}" start_at_video="1" playback_rate_speed="1"]

Only the custom field does not recognize the shortcode and the video player does not appear.

How can I use shortcodes from other plugins in custom Toolset fields?

For you to see how the shortcode is when I enter the custom Types field, just access this link: hidden link

#588810

I would suggest to use a WYSIWYG Field for that.
But also in other fields like Single Lines, at least the Toolset ShortCodes are working.

Can you elaborate what field you use, if other ShortCodes work in it for you, and if you could try to switch to a WYSIWYG Field?

#588822

Yes, I'll do the tests and call you here. Thanks for the answer

#588826

It did not work either, I switched the field to WYSIWYG and continued with the same problem.

When I use the wordpress editor on some page and I put this shortcode, everything works perfectly.

But when I put in the custom post by Toolset Types the shortcode does not work.

#589170

I did tests with other plugins that work with shortcodes and it still does not work.

Not even a shortform of a Contactform 7 form works when I enter the data in the custom field.

#589178

Por ex, nos arquivos do meu tema o código que pega as informações desse campo está assim:

$video_embed = get_post_meta($content_id, 'wpcf-video-embed', true);

I found another post in which a site had the same problem and managed to solve it, I believe that my problem is basically the same.

I found another post in which a site had the same problem and managed to solve it, I believe that my problem is basically the same. I just do not know how I can change my code to emulate this shortcode.

https://toolset.com/forums/topic/using-a-fontawesome-shortcode-inside-types-url-custom-field-does-not-work/

#589183

Sorry, this is the complete code.

 <?php
			
			$video_url = get_post_meta($content_id, 'wpcf-video-url', true);
			$video_embed = get_post_meta($content_id, 'wpcf-video-embed', true);
			
			if(!$video_embed) {//url

				//youtube
				if(preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $video_url, $matches))
				{
				  $videoId = $matches[1];
				  //make it embed!
				  ?>
#589577

The issue there is different.
The user added 3rd party shortcodes within Toolset ShortCodes.
That is called nesting shortcodes.

For that to be possible you need to do this:
https://toolset.com/forums/topic/using-a-fontawesome-shortcode-inside-types-url-custom-field-does-not-work/#post-298083

But I do not think this is the issue on your install.
You want to put a 3rd Party ShortCode in a Toolset field and then render that all together thru Toolset.
This works just fine if you add Toolset ShortCodes in our fields.

Now, to parse 3rd party ShortCodes in Toolset in our Fields, as per my tests you do not have to do anything.
Unless you add the Field with the "Posts Field" button which will produce this kind of ShortCode:

[wpv-post-field name="wpcf-your-field" parse_shortcodes="false/true"]

Note that here you can change the parse_shortcodes attribute to either parse them or not (shortcodes within this field)

But that is not necessary for Toolset ShortCodes like [types field='field'][/types]

Now, I think this is related to your specific kind of ShortCodes you tried to use.
Please try this simple example in your Theme's functions.php:

function the_test($atts = [], $content = null, $tag = '')
{
 $o = 'here';
 
    // return output
    return $o;
}

//Register the shortcode
add_shortcode('my-shortcode', 'the_test');

Then try to output it through a Toolset Field with this:

[my-shortcode]

That works. So I guess the ShortCodes you add expect and earlier execution.

Can you send me a copy of your site with the full instructions on where you added what, and how?
Eventually I can then provide a solution.

Thank you.

#590558

No, this works just fine, in a Clean and fresh updated Toolset/WordPress install with the Twenty Seventeen theme.
You must either have some plugin or theme active that disables this, or the code is misplaced.

When you insert this to functions.php:

function the_test($atts = [], $content = null, $tag = '')
{
 $o = 'here';
  
    // return output
    return $o;
}
 
//Register the shortcode
add_shortcode('my-shortcode', 'the_test');

And then insert this into a single line Types Field:

[my-shortcode]

This is output on the front end:

here

And that is correct. I tested this several times, it works.
It works as well on your install, I just tested it.

I created a New Custom Field (single line)
I inserted the function I shared with you to your Theme's Functions File
I added the ShortCode to the Single Line
I added the Single Line to a Post Body with our ShortCode and all works perfectly fine.

Please can you indicate me the exact URL of:
- the field edit screen in the backend (Field group used)
- a post where I need to insert my ShortCode
- where you generate the ShortCode for that Video

I can then make more tests locally about this

#590644

Hello Yes. I put the code in the functions.php file just as you directed me and it still did not work.

It keeps popping up the shortcode code and is not a result of it.

By accessing this link you can see what I'm trying to show.
hidden link

Shortcode does not render.

Shortcodes work on pages and posts. But they do not work on custom posts created by Toolset.

The Version of the Toolset I am using is: 2.2.20

To access the group of post fields you must enter this link below:
hidden link

The link will already automatically direct you to the group of posts that I'm having problems with.

The field we insert the video in is called: Embed Video.

In this next link I direct you to the profile of one of the models:
hidden link

The shortcode must be entered in the Video Embed field at the bottom of the page.

Note:
In this case, when we create a video in the template profile, the system also creates one that is listed within Videos:
hidden link

The Shortcode is placed or updated in the Embed Video field.

To generate the shortcode, I need to start creating a new post or page and just below the WordPress editor has an area called Easy Video Player Shortcode Generator.

In this area I insert the video and its title

#590654

You added those Fields to the Child Posts of type Video.
Hence you can not display it on a Parent Post, unless you call it in there, and you do not, as far I see.

I do not see anywhere the code that renders the Types field.
Where is it?
The video post has no post Body, hence it cannot be rendered there, also you do not apply the rest of Toolset, hence I am not sure how you add the Types Fields to your website?

You need to insert the Types Field with our shortcode, somewhere, to render it.

The forum ‘Types Community Support’ is closed to new topics and replies.