Save YT vid url to post object.
-
hello, there is any way to save youtube url to post data ( for example in “post_name” variable ) ? Or maybe there is other way to grab video url?
I just want to create gallery posts as image + url with forwarding to youtube ( not open on my page ).
In my code i grab thumbnail and title but cant grab video Url :/
if ( $query->have_posts() && $query != NULL) : echo '<div class="row">'; while ( $query->have_posts() ) : $query->the_post(); $post_ID = get_the_ID(); $post_thumbnail = get_the_post_thumbnail_url($post_ID); $post_title = get_the_title( $post ); echo '<div class="item-portfolio col-sm-6 col-md-3 col-lg-3">'; echo '<div class="bg-hover"><p>'.$post_title.'</p><i class="fa fa-play-circle-o absolute-center fa-vid-play" aria-hidden="true"></i></div>'; echo '<img class="vid-item item-portfolio" data-id="'.$post_ID.'" src="' . $post_thumbnail . '"></div>'; endwhile; echo '</div>'; /* Restore original Post Data */ else : __return_zero(); endif;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Save YT vid url to post object.’ is closed to new replies.