If you’ve ever wanted some Sass (SCSS) to show equal width elements regardless of how many there are, then look no further! Imagine you want…
Comments closedMonth: June 2017
It’s time to share a function I’ve used for years that reliably gets me the featured image of a WordPress post:
1 | function pk_get_featured_image($id = false, $size = 'full',$obj = false,$returnid = false){ if(!$id){ $id = get_the_id(); } $image_id = get_post_thumbnail_id($id); if(!$image_id){ return false; } $image_url = wp_get_attachment_image_src($image_id,$size,true); if(!$image_url){ return false; } if($returnid){ return $obj ? array('image_id'=>$image_id,'image'=>$image_url) : array('image_id'=>$image_id,'image'=>$image_url[0]); }else{ return $obj ? $image_url : $image_url[0]; } } |
Basically, at the…
Comments closed