How to Embed HTML files directly into WordPress

It would really help to know exactly what you’re trying to achieve. The more you work with WordPress, the more the sentence “Necessity is the mother of invention” makes sense. A WordPress site is essentially snippets of html code put together with php. For example, header.php contains the instructions to build the header, the page … Read more

How to add new embed handler not supported by oembed

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! ‘myvi_embed_handler’ ); } ); Here we constructed the regular expression in a way … Read more

Video embeds work in backend, but are not parsed in frontend

I’ve just looked at the source of the WP_Embed class, and it appears they are not actually registering a shortcode, but hooking into the the_content filter. Change your code to $content_desktop = apply_filters(“the_content”, get_the_content()); or manually trigger their filter with something like $content_desktop = WP_Embed::run_shortcode(get_the_content()); or, if you prefer to have an object: $myembeds = … Read more

Detecting Embed URLs Within post_content

OK, got it. I just dug around in wp core a bit and found the function they use to grab autodetcts. WP uses the php preg_replace_callback function within the WP autoembed function. Here is the code, as seen in wp-includes/class-wp-embed.php: /** * Passes any unlinked URLs that are on their own line to {@link WP_Embed::shortcode()} … Read more

WordPress embeds in AJAX inserted content

I think the solution is amazingly simple here: You’re just missing a single line of code in your ajax callback, namely: global $post; where I assume you’re using: $post = get_post( $post_id ); The reason is that there’s a global post check in the WP_Embed::shortcode() method. More details in my answer here.

Set wmode attribute to transparent for the embed shortcode to make drop-down menu hover over YouTube embed in Internet Explorer

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

Moving a PHP web-app to WordPress

In my opinion as long as your needs are exclusively about looks it’s never a good reason to migrate to entirely different code base. The separation of backend code and frontend site is inherently one of the strengths in web development. When you you are a lone developer on own project there are roughly three … Read more

Embed .mov file via ‘Add Media’ not working

You can try the following: /** * Add support for the QuickTime (.mov) video format. */ add_filter( ‘wp_video_extensions’, function( $exts ) { $exts[] = ‘mov’; return $exts; } ); to add the Embed Media Player support for the QuickTime video files. The default supported video formats are: mp4, m4v, webm, ogv, wmv, flv Update: When … Read more

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