How to change default width parameter of embedded video in wordpress?

if you could make it to something like this: <div class=”videoWrapper”> <iframe width=”600″ height=”338″ src=”https://www.youtube.com/embed/f5CcOq8UzkI?feature=oembed” frameborder=”0″ allowfullscreen=””></iframe> </div> then responsive css for that would be like this: .videoWrapper { position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0; } .videoWrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } … Read more

How add class youtube and type/html to oembed code?

You can try this: add_filter( ’embed_oembed_html’, ‘custom_youtube_oembed’ ); function custom_youtube_oembed( $code ){ if( stripos( $code, ‘youtube.com’ ) !== FALSE && stripos( $code, ‘iframe’ ) !== FALSE ) $code = str_replace( ‘<iframe’, ‘<iframe class=”youtube-player” type=”text/html” ‘, $code ); return $code; } to target the YouTube oembed HTML output. When I embed this YouTube link (Kraftwerk) into … Read more

oEmbed, thumbnails and wordpress

Use the oembed_dataparse filter to modify the resulting HTML output by any given oembed call. Example: add_filter(‘oembed_dataparse’,’test’,10,3); function test($return, $data, $url) { if ($data->provider_name == ‘YouTube’) { return “<img src=”https://wordpress.stackexchange.com/questions/19500/{$data->thumbnail_url}”>”; } else return $return; } Then putting this in a post: Will give you a picture of Rick Astley instead of a flash video of … Read more

Apply the_content filter to a custom field with multiple values

All you need to do use apply_filters. foreach ($video as $vid) { echo ‘<li>’.apply_filters(‘the_content’,$vid).'</li>’; } It may be more efficient to concatenate a string and then run the filter on the whole thing. $lis=””; foreach ($video as $vid) { $lis .= ‘<li>’.$vid.'</li>’; } echo apply_filters(‘the_content’,$lis); I haven’t benchmarked the one versus the other but given … Read more

Featured Image of Video from oembed

I needed just this for a recent project, so here’s my plugin! The code should be self-explanatory, but if there are any questions ask away. <?php /** * Plugin Name: oEmbed Featured Image * Plugin URI: http://wordpress.stackexchange.com/q/70752/1685 * Description: Automatically set the featured image if an oEmbed-compatible embed is found in the post content. * … Read more

static variable loop not working in WordPress

Try something like this: function realistic_get_first_embed_video($post_id) { $post = get_post($post_id); $content = do_shortcode(apply_filters(‘the_content’, $post->post_content)); $embeds = get_media_embedded_in_content($content); if (!empty($embeds)) { //check what is the first embed containg video tag, youtube or vimeo $counter = 0; foreach ($embeds as $embed) { // Check condition if count is 0 then // it is the first iteration if( … Read more

how to create a conditional content_width for a wordpress theme?

No, its not possible. $content_width is a theme-wide constant, and its set in functions.php before any of the query conditionals are set. $content_width is used to determine the intermediate image sizes in image_send_to_editor. The “large” image size will be set to the value of $content_width. If you need to modify those sizes on a per-category … Read more

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