• Resolved mahsunseven

    (@mahsunseven)


    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 ) );
    }

    please help , thanks

Viewing 1 replies (of 1 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @mahsunseven,

    Thank you so much for getting in touch.

    You can insert the code below:
    global $post; RankMath\Post::get_meta( 'title', $post->ID, RankMath\Paper\Paper::get_from_options( "pt_{$post->post_type}_title", $post, '%title% %sep% %sitename%' ) );
    Here’s what it would look like:
    'name' => RankMath\Post::get_meta( 'title', $post->ID, RankMath\Paper\Paper::get_from_options( "pt_{$post->post_type}_title", $post, '%title% %sep% %sitename%' ) );
    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

Viewing 1 replies (of 1 total)
  • The topic ‘Using the Rankmath title instead of the default title’ is closed to new replies.