Tag Info

New answers tagged

0

You need to add the query before the actualy displaying of the div, then you can run your conditional. According to get_posts() it returns an array, so I'm assuming it returns an empty array if posts aren't found, thus we can check is it's not ! empty() <?php $args = array( 'post_type' => 'attachment', 'orderby' => 'menu_order', ...


-1

You can use this wp_get_attachment_image( $attachment->ID, 'full' ); For more detail refer this Click Here


0

You want wp_get_attachment_image_src(): if ( $src = wp_get_attachment_image_src( $attachment_id, $size ) ) { echo $src[0]; // URL echo $src[1]; // Width echo $src[2]; // Height }



Top 50 recent answers are included