embed is a different sort of animal — use [video] instead…
For example:
<?php
echo do_shortcode( '[video width=352px height=198px src="' . $video_url . '"]' ); ?></div>
<?php } ?>
Thread Starter
allm
(@realblueorange)
The [video] shortcode is for embedding files. It does not take an a URL as input. I will try it anyway and report back.
I was wondering why I needed to use a short code in the first place. Placing a Vimeo or Youtube URL in a post or page results in embedding the movie. Placing / generating it in a template does nothing.
Any other ideas?
I use that code with youtube videos — for example, here: http://www.keatinginc.com/advisor/beth-kraszewski/
Thread Starter
allm
(@realblueorange)
@steve
To my surprise the [video] shortcode does work. Width and height seem to not take percentages, so I have set them to fixed values. And again surprisingly, the result is responsive, which is what I want.
The documentation in the codex has no info about the [video] shortcode taking a Vimeo of Youtube URL as input, so one has to wonder about what will happen in the future with this shortcode.
I’m still wondering why the [embed] shortcode doesn’t work. It is just one of the Built-In Shortcodes, like [video].
Does someone know why putting the bare URL does not work in templates and it does work in post and pages?
Anyway: thanks for pointing me in the right direction. Let’s say that it works, and that is more than the status from earlier… 😉
I’ll set this to resolved.
-
This reply was modified 6 years, 12 months ago by
allm.
I *think* embed isn’t really a shortcode, but a signal to the editor to look at the content and then figure out how to eembed it. Similarly, the bare URL is handled in the editor’s code.