W: Resize to find out!
H: Resize to find out!
Publicado hace: 14 años

WordPress: Extraer imagen adjunta de un post

Para extraer el attachment de un post podemos usar la siguiente función: function extraer_post_thumb($post_id, $class=»adjunto») { $images = get_children(array( ‘post_parent’ => $post_id, ‘post_type’ => ‘attachment’, ‘numberposts’ => 1, ‘post_mime_type’ => ‘image’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ )); foreach($images as $image) { $img = wp_get_attachment_image_src( $image->ID, ‘medium’); } $img = $img[0]; if(isset($img)){ echo »; } […]

Seguir leyendo (52 segs)