Title: Get Attachment for Video
Last modified: 7 februari 2018

---

# Get Attachment for Video

 *  [basclay](https://nl.wordpress.org/support/users/basclay/)
 * (@basclay)
 * [8 jaren, 8 maanden geleden](https://nl.wordpress.org/support/topic/get-attachment-for-video/)
 * Hi guys,
 * There is a plugin that let’s me upload a title, description and image with a 
   form.
 * If you send it, it creates and automatic post with the title, description and
   the image.
 * The code for showing the image is:
 *     ```
       if ( has_post_thumbnail() && is_single() ) { 
       		$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
       		?>
       		<div class="attachments">
       			<p class="image-caption"> <?php _e('Ingezonden video:','feature-request'); ?> </p>
       			<figure class="avfr-image post-image">
       				<?php 
       				echo '<a rel="lightbox" href="' . $large_image_url[0] . '" title="' . the_title_attribute( 'echo=0' ) . '">';
       				the_post_thumbnail( 'thumbnail' );
       				echo '</a>';
       				?>
       ```
   
 * I would like to rewrite the code so that I can upload a video and it automaticly
   posts the video , just like the image.
 * Can somebody help me with the code?

1 reactie aan het bekijken (van in totaal 1)

 *  [Remco Tolsma](https://nl.wordpress.org/support/users/remcotolsma/)
 * (@remcotolsma)
 * [8 jaren, 8 maanden geleden](https://nl.wordpress.org/support/topic/get-attachment-for-video/#post-106445)
 * You can get the videos attached (uploaded) to a specific post with the following
   code:
 * \`
    $videos = get_attached_media( ‘video’, get_the_ID() );
 * foreach ( $videos as $video ) {
    var_dump( $video ); } `
 * For more information about the `get_attached_media` function see: [https://codex.wordpress.org/Function_Reference/get_attached_media](https://codex.wordpress.org/Function_Reference/get_attached_media).

1 reactie aan het bekijken (van in totaal 1)

 Het onderwerp ‘Get Attachment for Video’ is gesloten voor nieuwe reacties.

## Tags

 * [attachment](https://nl.wordpress.org/support/topic-tag/attachment/)
 * [form](https://nl.wordpress.org/support/topic-tag/form/)
 * [Post](https://nl.wordpress.org/support/topic-tag/post/)
 * [video](https://nl.wordpress.org/support/topic-tag/video/)

 * In: [Code oplossingen gezocht](https://nl.wordpress.org/support/forum/code-oplossingen/)
 * 1 reactie
 * 2 deelnemers
 * Laatste antwoord van: [Remco Tolsma](https://nl.wordpress.org/support/users/remcotolsma/)
 * Laatste activiteit: [8 jaren, 8 maanden geleden](https://nl.wordpress.org/support/topic/get-attachment-for-video/#post-106445)
 * Status: onopgelost

## Onderwerpen

### Meest populaire onderwerpen

### Onderwerpen zonder reacties

### Non-support onderwerpen

### Opgeloste onderwerpen

### Onopgeloste onderwerpen

### Alle onderwerpen
