Create a gist now

Instantly share code, notes, and snippets.

<?php
// File Location /public_html/wp-content/plugins/ultimate-video-seo/classes/pvs_schema_markup_class.php
class pvs_schema_markup_class {
public function __construct() {
global $pvs_options;
if (!isset($pvs_options['pvs_rich']) ) {
add_action('the_content', array(&$this, 'pvs_schema_markup_function'));
}
}
public function pvs_schema_markup_function($content) {
global $post;
$thumbloc = get_post_meta( $post->ID, 'thumbloc', true );
$thumbtitle = get_post_meta( $post->ID, 'thumbtitle', true );
$thumbdesc = get_post_meta( $post->ID, 'thumbdesc', true );
$thumbplayer = get_post_meta( $post->ID, 'thumbplayer', true );
$thumbduration = get_post_meta( $post->ID, 'thumbduration', true );
$family = get_post_meta( $post->ID, 'family', true );
$thumbpubdate = get_post_meta( $post->ID, 'thumbpubdate', true );
$pvsdisable = get_post_meta( $post->ID, 'pvsdisable', true );
if (((is_single()) || (is_page())) && ($thumbloc !='') && ($pvsdisable != "yes")) {
$extra_content='<div itemprop="video" itemscope itemtype="https://schema.org/VideoObject" style="display:none;" >
<h2>Video: <span itemprop="name">'.$thumbtitle.' </span></h2>
<meta itemprop="duration" content="'.$thumbduration.'" />
<meta itemprop="embedUrl" content="'.$thumbplayer.'" />
<span itemprop="description">'.$thumbdesc.'</span>
<meta itemprop="uploadDate" content="'.$thumbpubdate.'">
<meta itemprop="thumbnailUrl" content="'.$thumbloc.'">
</div>';
$content .= $extra_content;
}
return $content;
}
}
new pvs_schema_markup_class();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment