Hot answers tagged

12

You can use the get_media_embedded_in_content() function for both shortcode and embedded media (it looks for these HTML tags: audio, video, object, embed, or iframe), just be sure to use content with applied filters and shortcode executed. For example: $post_id = 125; $post = get_post($post_id); //Get the content, apply filters and execute shortcodes $...


6

This is how I retrieve video (or any non-image) meta data. // assuming you have an attachment ID $meta = wp_get_attachment_metadata( $attachment->ID ); // See what meta data is available print_r( $meta ); // always check for the property's existence before trying to display it if ( ! empty( $meta['width'] ) ) echo $meta['width']; You can echo any ...


5

_e() echoes the translated string, which will not work in variable assignment. You need to use __(), which returns the translated string.


4

You can filter the HTML output for oEmbed with oembed_result. Now test the HTTP host of the URL for www.youtube.com and add the parameter. The oEmbed result is cached in a post meta field to avoid too many requests. To update old posts I have added an activation helper that clears those cached content for Youtube embeds only. <?php # -*- coding: utf-8 ...


4

I'm from the team that developes BuddyPress Media. Till now, capturing a video involved expensive (in various ways) setups. It depended on flash and silverlight which could reach the hardware (mic and webcam) . Html5 is the way to go, now. However, the support isn't wide enough. This might help you: https://stackoverflow.com/questions/7386675/video-capture-...


4

Aha! WordPress has a built in function for it :D <?php echo $embed_code = wp_oembed_get( $video ); ?> Simples.


4

That width is dictated by the $content_width global, defined by the Theme. To change it, you'll need to hook into after_setup_theme and modify it: function wpse124075_setup_theme() { global $content_width; if ( ! isset( $content_width ) ) { $content_width = 640; // your value here, in pixels } } add_action( 'after_setup_theme', '...


4

This is overview how you can make it working: First with below code you can detect youtube URL for details Please read: $reg = preg_match('|^\s*(https?://[^\s"]+)\s*$|im', $post_id_63->post_content, $matches); if (!$reg) return false; $url = trim($matches[0]); // youtube video url echo wp_oembed_get($url); // this will return youtube vidoe For ...


3

From the looks of it, you aren't echo-ing the do_shortcode function, which you should. Try this: <?php echo do_shortcode('[video webm="http://mb2013.mercerbell.com.au/wp-content/uploads/2013/10/sample_mpeg4.webmhd.webm" width="640" height="360" autoplay="true" loop="true"]'); ?>


3

The plugin uses cURl direkt instead of WordPress' built in HTTP class. If your sever does not support cURL, the plugin can not work and you got this message. Deinstall the plugin and use another one. Or replace the curl_it() function within the plugin with something stable. Update The workaraound: Open the plugin file youtube-sidebar-widget.php and ...


3

No, that is not possible. You can use oEmbed for some video sources, but for your own video you have to decide what a player you want to use. That’s exactly what plugins are for. There is no point in avoiding using them. Update In WordPress 3.6 support for native audio and video was added. Use the shortcodes [audio src="your/url"] and [video src="your/url"...


3

The WebM file format isn't known to WordPress by default, you have to add it. add_filter( 'upload_mimes', 'custom_mimes' ); function custom_mimes( $mimes ){ $mimes['webm'] = 'video/webm'; return $mimes; } The .ogg file format is known to WordPress as audio/ogg, if you're wanting to do video with it, the correct extension is .ogv.


3

You can't just put a play button over an image and expect it to play a video without some serious magic. What you can do easily is change the video oembed size depending on what the viewer is looking at, for example for the front loop you can have a very tiny (thumbnail size) video that plays, and if they click through to the post they get larger size. You ...


3

Take out the var_dump. That is debugging code, it's dumping the variable so that you can see what it is. Edit: Okay, I think you're asking the wrong question here, as did the other person in the question that you linked to. Adding additional query args onto the URL being sent to wp_ombed_url() won't cause the oembed system to send them on to the oembed ...


3

Registering a custom embed handler Here's an example how we can use the wp_embed_register_handler() function in your case: /** * Register an embed handler for myvi videos */ add_action( 'init', function() { wp_embed_register_handler( 'myvi', '#http://www\.myvi\.ru/watch/([a-zA-Z0-9_-]+)$#i', // <-- Adjust this to your needs! ...


3

Well... To embed a video or another object into a post or page, place its URL into the content area. Make sure the URL is on its own line and not hyperlinked (clickable when viewing the post). https://codex.wordpress.org/Embeds#What_About_oEmbed_Discovery.3F So, to "disable" embedding the simplest thing is to make sure the URL isn't ...


3

Let's say for simplicity that you're using ACF. You need to create a video link field once ACF is installed and assign it to posts. Then, in the post you want a video to show up, add the url. I usually assign this field as a text field and then have users enter the youtube id (last string of text after the youtube.com link. For example, if the video link ...


3

After further investigation this appears to be Vimeo blocking the requests. We have two sites (one where Vimeo videos work and one where they don't). When testing the retrieval of content via PHP we get "HTTP request failed! HTTP/1.1 403 Forbidden" on the faulty site. Anyone else reading this thread can run the same test with this script: https://pastebin....


3

The following code uses HTML5 Video, with the muted & autoplay attributes set. It takes the video, which I uploaded through the media gallery and displays it fullscreen. I'm using a script that detects when the video is done playing, then it fades out and is removed from the DOM. HTML <div class="fullscreen-bg"> <video muted autoplay id="...


2

It happens that I answered a similar Question. And adapting it a little bit, some serious magic can happen ;) Notes: the CSS is being printed inline. It should go with the theme's style.css and be adapted accordingly. each Featured Image is encapsulated in a div with id="videocontainer-' . $post_id . '". and a Javascript variable in printed together with ...


2

My boss has a wordpress site Ah, so many stories start this way. You don't, of course, want to edit core WP files; if you do, you will lose the changes when you update, among other issues. Modifying WordPress core files Why not use the existing post/page editor and a plugin that will make it easy for him/her? http://wordpress.org/extend/plugins/search....


2

That is a terrible idea as Flash movies with wmode transparent are not available to blind users with screenreaders any longer. Blind people do like to listen to videos, before that old chestnut comes up again. Use the HTML5 video embed to make it work for everyone and IE8 users getting a link to youtube. Don't make your accessibility suffer because old IE ...


2

Use 0 and 1 as shortcode values and use that show or hide the HTML attribute. Example with an element input and the attribute required: function input_shortcode( $atts ) { $values = shortcode_atts( array ( 'type' => 'text', 'value' => '', 'name' => '', 'id' => '', ...


2

Can this function be used to read the metadata on my videos hosted on Amazon S3, basically can this function be used for external video and audio? I don't think so. The WordPress code uses the PHP function file_exists() which doesn't say it cannot check external files. The ID3 code, however, tries to determine the web server operating system, so it looks ...


2

Taking a closer look at the code provided on that site, it appears that the main differences with what it output by default by WordPress is the following: the iframe is wrapped with a div that has a class of embed-container there are CSS styles that are used by that class In WordPress, to wrap the embed iframe, add the following to your theme's functions....


2

I ran into this problem while trying to make HTML videos behave like GIFs. WordPress's built-in video player uses HTML video elements but does not allow videos to play simultaneously. Instead of using the default WordPress video player (which is best used for more standard video content), I chose to manually use the <video> element via a custom ...


2

Assuming your content is in the variable $content you would begin by removing all html tags using wp_strip_all_tags: $new_content = wp_strip_all_tags( $content ); Then you will want to trim that to 200 characters using substr: $new_content = substr( $new_content, 0, 200 ); To retrieve the YouTube video, you'll need to use preg_match: preg_match( '/(<...


2

You could try mashing all the patterns together in one big regexp or and then doing a simple line by line parse of the content: function theme_oembed_videos() { global $post; if ( $post && $post->post_content ) { global $shortcode_tags; // Make a copy of global shortcode tags - we'll temporarily overwrite it. $...


2

I'm not quite sure if you need a dedicated page or a true archive page for this, but here is the two options If you need a dedicated page to display video post formats, you can make use of a custom query with a tax_query as post_format is just another build in taxonomy with post-format-video being a term to the post_format taxonomy. Your query on your page ...


2

I'm assuming you already know how to get your popup video working, and you want to know how to make sure only people who aren't logged in see the video. You can add this to your template file (footer.php is probably best): <?php if (is_front_page() && !is_user_logged_in()) { //video popup content } ?> WP: is_user_logged_in() » ...


Only top voted, non community-wiki answers of a minimum length are eligible