Sometimes you have a post with multiple attachments and it would be nice to see a count of the total media attached to a post. Adding this snippet to the functions.php of your wordpress theme will display the post attachment count in a custom admin column.read more
The WordPress dashboard includes a handy widget that displays some brief information about your site at a glance – rather creatively, it’s titled ’At a Glance’. By default it shows you the number of posts, pages and comments on your site allowing you to click through to edit each of those sections if you have the right permissions.read more
this months featured snippets
If you are using adjacent post relational links in the head of your wordpress theme add this little bit of jquery. This will let people navigate next, previous adjacent post with the left and right arrow keys.read more
Adding this snippet to the functions.php of your wordpress theme will add a select menu with an automatically generated list of your shortcodes. For everyone that is going to say hey wait a minute you posted this snippet before! Yes this is true but I added a few updates to this version.read more
Randomising the order of the returned posts in a WordPress query is easy – simply add
'orderby' => 'rand' to the arguments and you’re good to go – this is great, until you need to paginate the results. As soon as you navigate to the second page of the results, the posts are returned randomly once again and you get an entirely different set of posts that may or may not contain posts that you have already viewed – if you’ve experienced this before then you’ll know exactly how frustrating it can be. The first thing we need to do is make sure our PHP session is initiated and then we can use the
'posts_orderby' filter to handle the persistent randomisation.
With this little snippet you can add custom image sizes to media insert dialog box.
image_size_names_choose allows modification of the image size lists so that you can place a custom option within the media library.