WordPress theme compatibility


Using VideographyWP is pretty straight forward: you query different video platforms and import videos into existing posts and the plugin does all the embedding for you. All is good but if your WordPress theme has video display capabilities, you might want to embed the videos using your theme.
The good news is that you can, VideographyWP can be instructed to let the embedding be done by your WordPress theme.

By default, VideographyWP can import videos from either YouTube, Vimeo, Vine or Dailymotion into various free and premium WordPress themes like: Truemag, Avada, GookWork, Simplemag, Sahifa, Wave, Detube, Video, Beetube, VideoTube and VideoTouch.

In case your WordPress theme isn’t listed above, there is a very simple way of adding it to the list by placing a small piece of code into your theme/child theme functions.php file. Before anything, you will have to know how your theme is embedding videos and which post custom fields are used by it to embed videos.

First step is to identify your theme’s name. This can be found into the theme style.css file. In most cases it looks like this (taken from Twenty fifteen theme):

Theme Name: Twenty Fifteen
Theme URI: http://wordpress.org/themes/twentyfifteen
Author: the WordPress team

The name is obviously stored under Theme Name and that is what we will use into the code from our functions.php file:

 * Filter 'cvwp_add_theme_support' callback.
 * Adds compatibility for theme Twenty Fifteen.
 * !!! Please note that using this code with theme Twenty Fifteen
 * won't work with the plugin since the theme doesn't have its own
 * embedding capability but uses WordPress's default oEmbed.
 * @return array
function my_theme_compatibility( $themes ){
	$themes[ 'Twenty Fifteen' ] = array(
		'theme_name' 	=> 'Twenty Fifteen',
		'url'			=> 'https://wordpress.org/themes/twentyfifteen/',
		'meta' => array(
			'url' 		=> 'video_url'
	return $themes;
add_filter( 'cvwp_add_theme_support', 'my_theme_compatibility' );

Please note! If you use the code above in theme Twenty Fifteen, it won’t work because the theme doesn’t have video capabilities of its own but simply displays videos using WP oEmbed.

The code above tells the plugin that for WordPress theme Twenty Fifteen the video URL should be stored under custom field video_url. This should be all there needs to be done to make your theme compatible with the plugin. Now, when you change the plugin settings and tell it that the theme should handle all embeds, the plugin will know what fields to fill automatically.