get video from content

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( ‘/(<iframe.*?src=”https://wordpress.stackexchange.com/questions/154352/(.*?youtube.*?)”.*?<\/iframe>)/’, $html, … Read more

Query posts that contain video?

I don’t think there’s a fool-proofed way to do that, because the YouTube videos can be embedded in various ways and later be removed from the posts’ content. Here are few ideas: If you mean searching for e.g. the youtube string, then you could use the s argument in WP_Query. But the links might be … Read more

Remove Custom Divs from AMP pages

Thanks to Thomas’ answer to my question at StackOverflow – https://stackoverflow.com/questions/53158606/remove-div-with-a-class-without-removing-content Here’s how you can do it on WordPress for AMP. In your theme’s functions.php add the following:- add_action( ‘pre_amp_render_post’, ‘amp_vid_rmv’ ); function amp_vid_rmv() { add_filter( ‘the_content’, ‘amp_vid_div_rmv’ ); } function amp_vid_div_rmv($content) { $content = preg_replace(‘#<div class=”yt”>([\s\S]*?)</div>#’, ‘$1’, $content); return $content; } Please feel free … Read more

Adding video to a WordPress website [closed]

So, I don’t know what kind of videos you are including that would break the rules of these websites (especially Vimeo, I think they are pretty lenient on what you can upload there) but in general, I would usually advise against hosting your own videos. Websites like YouTube and Vimeo, who are specialized in this … Read more

filter get_children to return all mime types EXCEPT ‘x’

Looks like this is two questions: how to get all the children that are audio, and how to get all the children that aren’t audio. 1) The post_mime_type parameter of get_children can actually take a wildcard, so you could use: $children = get_children(array( ‘post_parent’ => $post->ID, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type => ‘audio/%’ … Read more

How to play a video without using plugin?

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. … Read more

YouTube Sidebar Widget – YouTube service unavailable

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 … Read more

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