-
I use this plugin to display videos on my website
This plugin displays structured data by default, but I want to use RankMath Seo title to display video data on the page.In the following code in the section
‘name’ => $episode->get_name(),/**
* Generates Episode structured data.
*
* Hooked into masvideos_single_episode_summary action hook.
* Hooked into masvideos_episodes_loop action hook.
*
* @param MasVideos_Episode $episode Episode data (default: null).
*/
public function generate_episode_data( $episode = null ) {
if ( ! is_object( $episode ) ) {
global $episode;
}if ( ! is_a( $episode, 'MasVideos_Episode' ) ) {
return;
}$markup = array(
'@type' => 'VideoObject',
'name' => $episode->get_name(),
'description' => wpautop( do_shortcode( $episode->get_short_description() ? $episode->get_short_description() : $episode->get_description() ) ),
'thumbnailUrl' => array( wp_get_attachment_url( $episode->get_image_id() ) ),
'uploadDate' => $episode->get_date_created()->date( 'c' ),
);if( ! empty( $episode->get_episode_run_time() ) ) {
$markup['duration'] = $episode->get_episode_run_time();
}$episode_choice = $episode->get_episode_choice();
if ( $episode_choice == 'episode_file' ) {
$markup['contentUrl'] = wp_get_attachment_url( $episode->get_episode_attachment_id() );
} elseif ( $episode_choice == 'episode_embed' ) {
preg_match( '/src="([^"]+)"/', $episode->get_episode_embed_content(), $match );
if( isset( $match[1] ) ) {
$markup['embedUrl'] = $match[1];
}
} elseif ( $episode_choice == 'episode_url' ) {
$markup['contentUrl'] = $episode->get_episode_url_link();
}$this->set_data( apply_filters( 'masvideos_structured_data_episode', $markup, $episode ) );
}
The ticket ‘Using the Rankmath title instead of the default title’ is closed to new replies.