I'm trying to render the block HTML dynamically by injecting it within a core/query block. The injection is working fine using DOMDocument, but I can't find out how to render the embed HTML. I can use wp_oembed_get for the iframe, but I need the wrapper DIVs, aspect ratio by provider, and so on.
I have a filter working to wrap embed_oembed links in a responsive wrapper. See code. add_filter('embed_oembed_html', 'wrap_embed_with_div', 10, 3); function wrap_embed_with_div($html, $url, $attr) { return '<div class="responsive-container">'.$html.'</div>'; } The only problem is this also applies to everything else on the oembed list, i.e, twitter embeds, instagram, etc. I was trying to add an if statement, but have no luck. Basically, it would be great to just add this wrapper to video embeds like youtube/vimeo. Here is what I got so …
PHP Fatal error: Cannot redeclare _wp_oembed_get_object() (previously declared in /home/samdonme/public_html/wp-includes/embed.php:112) in /home/samdonme/public_html/wp-includes/class-oembed.php on line 692 embed.php:112 function _wp_oembed_get_object() { static $wp_oembed = null; oembed.php on line 692 function _wp_oembed_get_object() { static $wp_oembed = null; if ( is_null( $wp_oembed ) ) { $wp_oembed = new WP_oEmbed(); } return $wp_oembed; As you see above, I am have problem with the embed.php and class-oembed.php. When I delete form setting.php require( ABSPATH . WPINC . '/class-oembed.php' ); problem is fixed. But I want to …
I am trying to get some oembed parameters attached to my Vimeo clips. I tried to get it going using the following two instructions: Passing Parameters to a Vimeo link in a WordPress Custom Field - LimeCanvas.com Any way to use a custom parameter for YouTube embed without using an iframe - WordPress.SE.com Unfortunately what works for YouTube won't work for Vimeo, as the returning URL has no such string as ?feature=oembed that I can make str_replace work on. It …
The goal is to grab the first video (embed or shortcode) from the post. So we need to check post content if it has embedded videos ( supported by WP ) or [video] shortcodes. Multiple videos and embeds could exist in the single post. If found any - return the very first of them, not depending on order of given patterns to match, but on order they have been inserted into the post. Here is my progress so far... This …
I'm trying to use the "Embed URL" block to include another WP site's tag page on my WP page. It seems like I'm able to embed individual posts from that site (so the theme supports embedding) but I get the error "Sorry, this content could not be embedded." when I try to use the tag page url. Is it possible to embed a tag page?
So I don't know how to properly do this and I've already spent like 3+ hours attempting to figure this out, so I'm getting help from the community. What I'm trying to achieve: Add class='optanon-category-C0002' and change the src to data-src in the iFrame that wordpress builds up. Here is what I have: public function get_modal() { $config = [ 'content' => '<p>The video is currently unavailable.</p>', ]; $video_link = ''; if ($video = $this->get_video()) { foreach ($this->get_video()->get_sources() as $each_video) …
How can i add : class="youtube-player" type="text/html" to iframe like : function Oembed_youtube_no_title($html,$url,$args){ $url_string = parse_url($url, PHP_URL_QUERY); parse_str($url_string, $id); if (isset($id['v'])) { return '<iframe class="youtube-player" type="text/html" src="https://www.youtube.com/embed/' .$id['v'].'?vq=large&autohide=1&autoplay=1&fs=1&hl=fr&rel=0&loop=1" frameborder="0" allowfullscreen></iframe>'; } return $html; }
I used to have both PCsteps.gr and Lifesteps.gr on the same server with the same IP. Oembed would work by default, I could embed posts from one site to the other without any problems. However, since moving lifesteps.gr on a different server, embeds won't work anymore. It is my understanding that to embed lifesteps posts to pcsteps, I need to add lifesteps as an oembed provider to pcsteps. I have added the following code, that I have created here. // …
In my install, I use one custom page. Here I put one text field and the fck editor. This is for the title and the content. I need to insert this into a page. I use the following code $my_post = array( 'post_title' => $_POST['title'], 'post_content' => $_POST['content'], 'post_type' => 'page', 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 10, ); // Insert the post into the database $post_ID = wp_insert_post( $my_post ); In the content field, I insert the …
Having the exact same problem as @Hjalmar on Advanced Custom Fields, but still no fix. Only the URL text displays. Tried the original ACF oembed option: <div class="embed-container"> <?php echo get_field('video_embedd'); ?> </div> No luck. Placed the YouTube embed URL in the ACF text field and outputting it into an HTML iframe: <?php $videoEmbeddPlease = get_field('video_embedd'); if (!empty($videoEmbeddPlease)): ?> <iframe width="560" height="315" src="<?php echo $videoEmbeddPlease?>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <?php endif ?> No luck. Even tried the …
I'm trying to remove the entire embed_footer from WordPress embedded posts. By adding the following code in the functions.php, I was able to remove the site title and comments icon. But still, the share icon is there. add_filter('embed_site_title_html','__return_false'); remove_action( 'embed_content_meta', 'print_embed_comments_button' ); Is there a way to remove the entire embed_footer? Or can I remove the share button also like the above code?
I am able to paste a Youtube link into a post and have it auto embed just fine, but if I go to edit a media description, and put the link there, and then view the attachment page for that media, it just makes the URL clickable. I have tried using just the link, the embed shortcode, and Jetpack's youtube shortcode. All of them work on posts and pages, but not attachment content. I have tried using apply_filters('the_content', $img->post_content); instead …
I have a function in my wordpress theme that deletes the first embedded video in a video post. See code below. This is in the functions.php file. /* - function that hides first video in post content - */ function process_embed( $embed ){ if ( is_single() && get_post_format() === 'video' ) { static $post_video_num = 0; $post_video_num++; // Hide first video in the post content on single video post page if ( 1 === $post_video_num ) { return ''; } …
Is there a way to search all posts and pages in my WordPress site and find those who have a Youtube video embedded in them? The reason to do that is I want to disable the wp-embed.min.js but before doing that, I need to confirm there are no posts or pages that embed Youtube videos. Update I create a test post and embed a Youtube video in it, and then check the HTML source, and find the following one: <div …
I'd like to be able to add classes to oembed videos on the fly in the post editor. This way I could have some videos act like images and alignleft or alignright and have text wrap around them, while the default behavior would be to set the video full width of the containing element and act responsively on resize. I already have that default behavior working via this function and some CSS: // remove dimensions from oEmbed videos & wrap …
My developer created custom theme for WP, and for some reason Wordpress fails to embed video URL on user-end. Everything is fine with Default WP themes, also video is fine on visual mode, but if I try to switch to this theme- I see only the video URL, but not embed video. Looks like we need to add something to our theme, but can't find any manual - what we need to add to function.php? thanks
We've multisite on single wordpress installation. For example, Main site - testsite.com/ Sub site - testsite.com/subsite Now when I try to embed a blog from subsite into mainsite or vice verca or post of subsite into subsite, it gives the error Sorry, this content could not be embedded. Also when I see network call I see this error response, {"code":"oembed_invalid_url","message":"Not Found","data":{"status":404}} This is how I'm embedding a blog from subsite. I'm not sure what I'm doing wrong. Thank you!
First of all, let me mention that I have already looked at the following two similar questions: Is it possible to modify the default YouTube embed attributes string? Filter oembeds tags to modify iframe attributes But both of them are pre Gutenberg era. So, while using Gutenberg oEmbed block to embed a YouTube video if I want to add a srcdoc attribute to it, is there a way to do it? Or do I have to create my custom block …
Good Afternoon, i want to embed this video in my wordpress https://streamtape.com/v/7qDqGjlQe4UA9MR/Soul_Land_03_VOSTFR.mp4 Embed code <iframe src="https://streamtape.com/e/7qDqGjlQe4UA9MR/Soul_Land_03_VOSTFR.mp4" width="800" height="600" allowfullscreen allowtransparency allow="autoplay" scrolling="no" frameborder="0"></iframe> I have tried to paste the following code in my theme function.php file but it doesn't function. I would be very happy to receive your help add_action( 'init', function() { wp_embed_register_handler( 'streamtape', '#https://streamtape\.com\/v\/([a-zA-Z0-9_-]+)$#i', 'streamtape_embed_handler' ); } ); function streamtape_embed_handler( $matches, $attr, $url, $rawattr ) { $embed = sprintf( '<IFRAME SRC="https://streamtape.com/e/([a-zA-Z0-9_-]+)$#i" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH=800 HEIGHT=600 allowfullscreen></IFRAME>', …