I would like to execute a shortcode for responsive vimeo embeds in a custom field type. Due to wordpress stripping shortcodes outside of the body however I am unable. Does anybody know how to make this happen?
Thanks so much!
Hi jamesG-3,
I suggest you create another shortcode for it, for example your custom field is using slug my-vimeo. created with Types, in database it's meta-key is wpcf-my-vimeo,
You can try this:
1) add codes in your theme/functions.php:
function my_vimeo_func( $atts ) {
$my_vimeo = get_post_meta(get_the_ID(), 'wpcf-my-vimeo', true);
return do_shortcode($my_vimeo);
return "foo = {$foo}";
}
add_shortcode( 'my-vimeo', 'my_vimeo_func' );
2) use shortcode [my-vimeo] in your content
More help:
http://codex.wordpress.org/Function_Reference/add_shortcode
Thank you for the response. I am actually trying to use an existing shortcode that came with the skeleton theme
[vimeo id="68293434" responsive="true" center="false"]
Because it does a fantastic job of resizing the videos in a responsive manner on tablets etc. In trying the method above I was unable to subsequently replicate the responsive video sizing.
My hope is to place this shortcode within a view and be able to have that show the video if that makes sense?
Thanks again!
I suggest try create a custom field vimeo-id to store 68293434 values
Go to Views -> Settings and simply add them under the section Third-party shortcode arguments:
add "vimeo"
Then use below shortocde within your view content
[vimeo id='[types field="app-id"][/types]' responsive="true" center="false"]
More help:
Shortcodes within Shortcodes – Control Any Shortcode with Types Fields
https://toolset.com/documentation/user-guides/shortcodes-within-shortcodes/
That worked a treat, thanks so much!