• Resolved Rafa?

    (@ayek)


    Hi!
    How to override /classes/pages/class-property-single-page.php?
    I’d like to customize embedding video with iframe code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Estatik

    (@estatik)

    Hi there,
    Unfortunately, it is not possible to override plugin classes, but you can override single_video_tab of this class in functions.php file of your child theme using the code below:

    global $es_single_page_instance;
    remove_action( ‘es_single_video_tab’, array( $es_single_page_instance, ‘single_video_tab’ ) );
    add_action( ‘es_single_video_tab’, ‘my_custom_video_tab’ );
    function my_custom_video_tab() {
    // Your custom responsive iframe code here.
    }

    Let us know if you managed to do this. Thanks!

    • This reply was modified 4 years, 7 months ago by Estatik.
    Thread Starter Rafa?

    (@ayek)

    Thank you! Works!

    My code is not clever at all to adapt various proportions, I’ve just wrap iframe with WP tags and classes, however I get YouTube 16:9 video fully responsive.

    global $es_single_page_instance;
    remove_action( 'es_single_video_tab', array( $es_single_page_instance, 'single_video_tab' ) );
    add_action( 'es_single_video_tab', 'my_custom_video_tab' );
    function my_custom_video_tab() {
      global $post;
      $es_property = es_get_property( $post->ID );
      ob_start(); do_action( 'es_single_tabbed_content_after', 'es-video' ); $content = ob_get_clean();
      if ( $es_property->video || $content ) : ?>
        <div class="es-tabbed-item es-video" id="es-video">
          <h3><?php _e( 'Video', 'es-plugin' ); ?></h3>
          <figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio">
            <div class="wp-block-embed__wrapper">
            <?php if ( $es_property->video ) : ?>
              <?php echo htmlspecialchars_decode( $es_property->video ); ?>
            <?php endif; ?>
            </div>
          </figure>
          <?php echo $content; ?>
        </div>
      <?php endif;
    }

    Maybe it would be an incentive to improve Estatik at this point.

    Plugin Author Estatik

    (@estatik)

    You are very welcome!

    We are glad that you successfully resolved the issue with embedded video and will consider your suggestion.

    Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Responsive embedded video – How to override template?’ is closed to new replies.