wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Set default attachment display settings, alignment, link to, size in wordpress

wordpress snippet

Have you ever wanted to change the default options when inserting media into a post? Setting the default alignment to “left” or the default size to “large” ? This may not appear to be a big deal but if you are constantly changing the settings to the same thing over and over again for each image this is a must have snippet. We are updating the options “image_default_align, image_default_link_type, image_default_size”. Keep in mind that this just changes the default settings of these options within the add media popup. The method we use to update these options can be used for a number of other options including what you can find in this options reference.

read more

Display post attachment count in admin column

wordpress snippet

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

Remove unneeded images / thumbnail sizes

wordpress snippet

Adding some or all of these lines of code to the functions.php of your wordpress theme will effectively remove some of the default images sizes that may be unneeded. Make sure to include both the _w _h for width and height,

read more

Add a custom class to wp_get_attachment_link

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will add a custom class to wp_get_attachment_link.

read more

Display total number of PDF files in your media library

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will return the total number of PDF files within your media library.

read more

Check if post has more than one image attachment

wordpress snippet

Adding this snippet to your wordpress theme will let you determine if a post has more than one image attachment or modify the count to check for a specific number of image attachments.

read more
jqsnipp.com | we just launched jquery snippets website