Oembed and shortcode tag???
-
I am setting up a shortcode tag so I can have user across all blogs enter some info in a pre-formated layout. I am using Oembed with the latest MU and BP. My problem is in the content section of the shortcode, if someone posts a link to a video it just shows a link and not the embedded video.
Here is an example of what I mean…
function my_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'item1' => 'default value',
), $atts ) );
return $item1 . $content;
}
add_shortcode('my_shortcode', 'my_shortcode');
[my_shortcode item1="something"] http://www.youtube.com/watch?v=Er7ajPdMfb4 [/my_shortcode]I am hoping there is an easy way to make this work?
-
is do_shortcode triggered on the content?
No I am not using it, I am new to using shortcodes and open to any suggestions.
Anyone know how to make Ombed work with this?
If not I guess I will have to edit kses.php and allow for object, param, and embed tags along with all of the attributes needed. Is this a major security flaw to do so?
just like adding the filter do_shortcode to the content you want to act on – you can add more to the kses for allowedtags via filter as well.
EDIT: Just re-reading this.
Do you want users to be able to post oEmbedded video on blog posts or in BP activities?
It will be in posts, through a shortcode.
Why don’t you just use the default oEmbed class in WordPress?
https://codex.wordpress.org/Embeds
http://www.viper007bond.com/2009/10/13/easy-embeds-for-wordpress-2-point-9/
Shortcodes work like this:
[embed]youtube link[/embed]
You can enable oEmbed support across all blogs with the New Blog Defaults plugin:
https://wordpress.org/extend/plugins/wpmu-new-blog-defaults/
Thanks! Reading through some of those links I gathered that to embed the video the link needs to be on its own line, and now its working.
This does not work
[myshortcode] Some text or whatever MY LINK [/myshortcode]
This does not work
[myshortcode] MY LINK [/myshortcode]
This works
[myshortcode]
Some text or whatever
MY LINK
[/myshortcode]
This works
[myshortcode]
MY LINK
[/myshortcode]
Hi
Adding a picture works great on the main activity feed but shows only the url on the profile page of the user and the link does not work it seems cut off at the end.
Also replys to posts with pictures only show the url not the image
Can an image be displayed instead ?
Thanks
Gibby
Hi
Adding a picture works great on the main activity feed but shows only the url on the profile page of the user and the link does not work it seems cut off at the end.
Also replys to posts with pictures only show the url not the image
Can an image be displayed instead ?
Thanks
Gibby
- The topic ‘Oembed and shortcode tag???’ is closed to new replies.