• Resolved Lysefjordcam

    (@kmhaugen)


    Happy new year.

    Using Tracks 1.44 with premium Featured Videos license.

    The embedded Youtube Featured Video does not show any more. I has been working up till recently and I’ve not done any changes.
    In edit page mode everything seems ok, but in live page the video does not show at all.
    I can see the code when viewing the source.

    What can be wrong?

    All the best.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Theme Author Ben Sibley

    (@bensibley)

    Thanks for upgrading, I’m sorry the video is no longer showing.

    Could you share a link to a post/page with a video that isn’t showing properly? Once I check it out I should be able to come up with a solution.

    Thread Starter Lysefjordcam

    (@kmhaugen)

    Sure,

    Here’s the link: https://www.lysefjordcam.com/live-video-stream/
    I’m using the Tracks Child theme with very little custom code, but I’ve not done any changes since it was working.

    Below is my only custom functions.php code:

    <?php 
    
    // for displaying featured images including mobile versions and default versions
    if( ! function_exists( 'ct_tracks_featured_image' ) ) {
        function ct_tracks_featured_image() {
    
            global $post;
            $has_image = false;
    
            $premium_layout = get_theme_mod( 'premium_layouts_setting' );
    
            if ( has_post_thumbnail( $post->ID ) ) {
    
                if ( ( is_archive() || is_home() ) && $premium_layout != 'full-width' && $premium_layout != 'full-width-images' ) {
                    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
                } else {
                    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
                }
                $image     = $image[0];
                $has_image = true;
            }
            if ( function_exists( 'uses_nelioefi' ) && uses_nelioefi( $post->ID ) ) {
      			$has_image = true;
      			$image = nelioefi_get_thumbnail_src( $post->ID );
    		}
            if ( $has_image == true ) {
    
                // for layouts using img
                if ( $premium_layout == 'two-column-images' ) { ?>
                    <img class="featured-image" src='<?php echo $image; ?>' /><?php
                } elseif (
                    ( ( is_archive() || is_home() ) && $premium_layout == 'full-width-images' && get_theme_mod( 'premium_layouts_full_width_image_height' ) == 'image' )
                    || is_singular() && $premium_layout == 'full-width-images' && get_theme_mod( 'premium_layouts_full_width_image_height_post' ) == 'image'
                ) { ?>
                    <img class="featured-image" src='<?php echo $image; ?>' /><?php
                } // otherwise, output the src as a bg image
                else {
                    // if lazy loading is enabled
                    if ( get_theme_mod( 'additional_options_lazy_load_settings' ) == 'yes' ) {
                        echo "<div class='featured-image lazy lazy-bg-image' data-background='$image'></div>";
                    } // if lazy loading is NOT enabled
                    else {
                        echo "<div class='featured-image' style=\"background-image: url('" . $image . "')\"></div>";
                    }
                }
            }
        }
    }
    
    function ct_tracks_excerpt_read_more_link( $output ) {
            global $post;
    
            return $output . "<p><a class='more-link' href='" . get_permalink() . "'>" . __( 'Show more', 'tracks' ) . "<span class='screen-reader-text'>" . get_the_title() . "</span></a></p>";
    }
    add_filter('the_excerpt', 'ct_tracks_excerpt_read_more_link');
    Theme Author Ben Sibley

    (@bensibley)

    Great thanks for the link and code.

    Could you try temporarily switching from your Tracks child theme to just Tracks? I think the conflict may be coming from the featured image function in the child theme.

    Please let me know if this makes a difference, and we can take action on a solution.

    Thanks!

    Thread Starter Lysefjordcam

    (@kmhaugen)

    The Featured Video works fine with just the Tracks theme.

    Morten

    Theme Author Ben Sibley

    (@bensibley)

    Thanks for trying that.

    If I recall correctly, the featured image function is being used to add support for a live streaming plugin. Are you using this functionality on your site right now, or could this function be removed from the child theme?

    Removing it should fix the video display issue, but if that’s not possible I can help create a modified version of it that will be compatible.

    Thread Starter Lysefjordcam

    (@kmhaugen)

    Since i’m showing webcam images that’s constantly updated externally I’m using the “Nelio External Featured Image” plugin so its not possible to remove that, sorry. It’s not a live video streaming plugin, but I can use external images as features image without it being in the WP media library. If you could create/modify a version that will be compatible I would be very happy. Thank you very much Ben.

    Morten

    Theme Author Ben Sibley

    (@bensibley)

    Okay cool, please try this function in place of the existing one:

    if ( ! function_exists( 'ct_tracks_featured_image' ) ) {
    	function ct_tracks_featured_image() {
    
    		global $post;
    		$has_image      = false;
    		$featured_image = '';
    		$image          = '';
    
    		// get the current layout
    		$premium_layout = get_theme_mod( 'premium_layouts_setting' );
    
    		if ( has_post_thumbnail( $post->ID ) ) {
    			// get the large version if on archive and not one of the full-width layouts
    			if ( ( is_archive() || is_home() ) && $premium_layout != 'full-width' && $premium_layout != 'full-width-images' ) {
    				$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
    			} else {
    				$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
    			}
    
    			$image     = $image[0];
    			$has_image = true;
    		}
    		if ( function_exists( 'uses_nelioefi' ) && uses_nelioefi( $post->ID ) ) {
      			$has_image = true;
      			$image = nelioefi_get_thumbnail_src( $post->ID );
    		}
    		if ( $has_image == true ) {
    			// if lazy loading is enabled
    			if ( get_theme_mod( 'additional_options_lazy_load_settings' ) == 'yes' && ( is_archive() || is_home() ) ) {
    				$featured_image = "<div class='featured-image lazy lazy-bg-image' data-background='" . esc_url( $image ) . "'></div>";
    			} else {
    				$featured_image = "<div class='featured-image' style='background-image: url(" . esc_url( $image ) . ")'></div>";
    			}
    		}
    
    		$featured_image = apply_filters( 'ct_tracks_featured_image', $featured_image, $image, $has_image );
    
    		if ( $featured_image ) {
    			echo $featured_image;
    		}
    	}
    }

    That should allow the nelio plugin to work and also show the featured videos.

    Thread Starter Lysefjordcam

    (@kmhaugen)

    That was perfect!
    Tracks is not only a great Theme, but has world class support too!
    Thank you so much Ben.
    Wish you a happy 2016.

    All the best
    Morten

    Thread Starter Lysefjordcam

    (@kmhaugen)

    Resolved ??

    Theme Author Ben Sibley

    (@bensibley)

    You’re welcome, I’m happy to help!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Featured Videos’ is closed to new replies.