Title: kidconcept's Replies | WordPress.org

---

# kidconcept

  [  ](https://wordpress.org/support/users/kidconcept/)

 *   [Profile](https://wordpress.org/support/users/kidconcept/)
 *   [Topics Started](https://wordpress.org/support/users/kidconcept/topics/)
 *   [Replies Created](https://wordpress.org/support/users/kidconcept/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/kidconcept/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/kidconcept/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/kidconcept/engagements/)
 *   [Favorites](https://wordpress.org/support/users/kidconcept/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Video OR Featured Image](https://wordpress.org/support/topic/video-or-featured-image/)
 *  [kidconcept](https://wordpress.org/support/users/kidconcept/)
 * (@kidconcept)
 * [14 years ago](https://wordpress.org/support/topic/video-or-featured-image/#post-2287607)
 * Oh, I also modified 16am’s code so that it would only display the iframe if there
   is a video in the post.
 *     ```
       function catch_video() {
         global $post, $posts;
         $first_vid = '';
         ob_start();
         ob_end_clean();
         $output = preg_match_all('/<iframe.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
         $first_vid = $matches [1] [0];
   
         if ($output == '1') {
         echo '<iframe width="450" height="310" src="';
         echo $first_vid;
         echo '" frameborder="0" allowfullscreen></iframe>';
         }
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Video OR Featured Image](https://wordpress.org/support/topic/video-or-featured-image/)
 *  [kidconcept](https://wordpress.org/support/users/kidconcept/)
 * (@kidconcept)
 * [14 years ago](https://wordpress.org/support/topic/video-or-featured-image/#post-2287606)
 * 16am that code worked great for me, thanks!
 * rustbuckle: paste that echo catch_video() snippit in your template files where
   you want the video to display. In the loop means the part of template that renders
   your posts. It’s a larger discussion than I’ll have here, but for more info read:
   [http://codex.wordpress.org/The_Loop](http://codex.wordpress.org/The_Loop)
 * you’ll find the loop in different template files depending on the theme you are
   using, but a good place to look is the front-page.php file. Your theme might 
   call the loop here and then from within the loop call get_template_part( ‘content’).
   This indicates that the loop looks for the content.php template file and renders
   it over and over (looping), once for each post until you have displayed all of
   the posts.
 * In my case I pasted echo catch_video() into a special template file that I’m 
   using to render only my sticky posts. The sticky posts are using excerpt’s and
   featured images to display a quick version of the post on the front-page, and
   I wanted the video to display there. This special template file I’m using is 
   called from the loop on front-page.php with this line: get_template_part( ‘content’,‘
   issticky’ );
 * Starting to make sense? If not, just open up some likely template files and paste
   the echo line in likely locations, one at a time. Eventually you’ll start to 
   see where in the template files is corresponding to your web page in-browser.

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