Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter javanpa

    (@javanpa)

    That’s what I thought should work, but for some reason it isn’t. This is my current modification to that function:

    function ct_tracks_pro_output_featured_video( $featured_image ){
    
    	if ( trim( get_option( 'ct_tracks_featured_videos_license_key_status' ) ) != 'valid' )
    		return $featured_image;
    
    	// get the post object
    	global $post;
    
    	// check for a featured video
    	$featured_video = get_post_meta( $post->ID, 'ct_tracks_video_key', true );
    
    	if( $featured_video ) {
    
    		// get the display setting (post or blog)
    		$display_blog = get_post_meta( $post->ID, 'ct_tracks_video_display_key', true );
    
    		// post and setting is post or both, or if the blog and setting is blog or both, or if a page
    		if(
    			( is_singular() && ( $display_blog == 'post' || $display_blog == 'both' ) )
    			|| ( ( is_home() || is_archive() || is_search() ) && ( $display_blog == 'blog' || $display_blog == 'both' ) )
    			|| is_singular('page')
    		) {
    			$featured_image = '<!-- Jordan Was Here --><div class="featured-video">' . wp_oembed_get( esc_url( $featured_video ) ) . '</div>';
    		}
    	}
    
    	return $featured_image;
    }

    When viewing a post that has a featured image, and that featured image is displayed, this is the html output of that section:

    <div class="post-1727 post type-post status-publish format-standard hentry category-member-podcasts pmpro-level-required pmpro-level-1 pmpro-has-access entry has-video full-without-featured odd excerpt-1">
    	<div class="featured-video"><iframe src="https://player.vimeo.com/video/263140521?app_id=122963" width="500" height="281" frameborder="0" title="Ep25 - MPLS Part 1" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>	<div class="entry-meta">
    			<span class="date">April 5, 2018</span>

    My modified $featured_image output is nowhere to be seen. Thoughts?

    Thread Starter javanpa

    (@javanpa)

    Ben,

    I ended up just using a redirect for now so the content of the post didn’t display at all. There wasn’t a clean way to do what I wanted from the membership side. That being said…

    I’m still looking in to a more elegant solution for manipulating the featured video. I’ve dug through the code and have found my way to the ct_tracks_pro_output_featured_video() function in licenses/functions/video.php. From everything I can tell, the hook on line 290 (add_filter( 'ct_tracks_featured_image', 'ct_tracks_pro_output_featured_video', 20 );) should be what supersedes the featured-image variable in ct_tracks_featured_image() in functions.php. I’ve tried adding an html comment just before the <div> tag in the featured-image variable but it just never seems to show up in my code.

    What am I missing? Where does the actual embed code for the featured video come from if not from that function? Ultimately I would like to wrap a membership checker around the featured video in the code but can’t seem to find where that final output comes from. If you could point me in a direction, that would be very helpful. Thanks.

    Jordan

Viewing 2 replies - 1 through 2 (of 2 total)