Title: Why this code is not working
Last modified: August 20, 2016

---

# Why this code is not working

 *  [linrakesh](https://wordpress.org/support/users/linrakesh/)
 * (@linrakesh)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/why-this-code-is-not-working/)
 *     ```
       function video() {
            echo '<h3>Featured Video</h3>';
            query_posts(array('category_name' => 'videopost','showposts' => 1));
       	 if (have_posts()) :
       	   	while (have_posts()) : the_post();
       		  $dn = get_post_meta($post->ID, "video", TRUE);
       		 	   //the_excerpt('');
       			   echo "<iframe width=\"300\" height=\"300\" src=\"http://www.youtube.com/embed/".$dn."\" frameborder=\"0\" allowfullscreen></iframe>";
       		endwhile;
       	endif;
       	wp_reset_query();
       }
       ```
   
 * I am not able to extract post meta data through this code. Though the same code
   is working fine in single.php file and able to extract the video meta data from
   the same post.

The topic ‘Why this code is not working’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [linrakesh](https://wordpress.org/support/users/linrakesh/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/why-this-code-is-not-working/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
