We make a lot of templates that work with YouTube videos. Most of these videos are added by the client via a text field…
Comments closedTag: php
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 closedThe Problem Sometimes you want to have a form on a page that acts like a filter. If the page has URL variables from…
Comments closedWordPress does not, by default, allow regular php sessions to be used. You can enable them, though. The easiest way I’ve found is to add…
Leave a CommentOne thing I dislike about WordPress taxonomies is that there is no built in way to limit a post to only having 1 term for…
Leave a CommentSometimes you might want to have the permalink of a post type include the taxonomy in the path. This is a pretty specific thing to…
Leave a Comment