WordPress.org

Ready to get started?Download WordPress

Forums

Why this code is not working (1 post)

  1. linrakesh
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags