Get video from the post on homepage

Couple of assumptions before getting to solution. First, you have all embedded codes as iframe (almost all video sites export as iframe now) not as shortcode or object tag. Secondly, you want the video box not the video url which will be offcourse different for every video website. Put following code in functions.php function the_post_video($post_id=NULL) … Read more

Video post format, extra content breaks video embed

If you don’t know what the content is, use a regular expression to test if there is an URL. Sample code: $content = get_the_content(); $pattern = ‘~([^”\’])?(https?://.*\.(flv|aac|mp4|mov|m4a|f4a|ogg|oga|mp3))([^”\’\?])?~i’; if ( preg_match( $pattern, $content, $matches ) ) { $parsedUrl = parse_url( $matches[ 0 ] ); // create the vidoe markup } else { // echo $content or … Read more

Are self-hosted videos a good idea? [closed]

This is rather subjective but here is my view. I have built video galleries used on public and private servers. I use Miro for compression in open source formats and video.js to support embedded viewing. Miro does a great job of minimizing bandwidth consumption. video.js has been more than adequate; I consider it a very … Read more

tags disappear on pages (but not on posts!)

On the current theme, there was no page.php file present, so WordPress was reading index.php and, according to the theme’s instructions, displaying the_excerpt(). It will strip many tags, including <video>, and that’s exactly what was happening. The content of the posts is is displayed based (mainly) on the contents of the file single.php, but for … Read more

Pull Youtube Link from 2nd WP_Editor

Maybe you should just add a custom field to accept the url itself, in stead of the wp_editor textarea; then append the video embed after you work with the input. Let me know if you need any help setting that up. OR: You could add a separete textarea to accept just comma separated or line-break … Read more

Add class to oEmbed video from within post editor?

One idea for the shortcode version, would be to add the custom class via the the native shortcode: then you could add it to your custom wrapper with: add_filter( ’embed_oembed_html’, function ( $html, $url, $attr, $post_ID) { return sprintf( ‘<figure class=”video-container %s”>%s</figure>’, isset( $attr[‘class’] ) ? esc_attr( $attr[‘class’] ) : ”, $html ); }, 10, … Read more

Display the video of a post_format Video

I made a function that return the iframe for the first video inside the post with id $post_id: function get_first_video_embed($post_id) { $content = apply_filters(‘the_content’, get_post_field(‘post_content’, $post_id)); $iframes = get_media_embedded_in_content( $content, ‘iframe’ ); return $video_post_iframe = $iframes[0]; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)