wordpress snippets last updated   : April 14, 2014
we now have 630 snippets

Add rel=”lightbox” to all images embedded in a post

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will add a rel=”lightbox” attribute to all images embedded in your post. Also note that on line 05 you can change the rel=”lightbox” to whatever you need as some image viewer scripts will use rel=”thumbnail” for example. This snippet will also add the post title as the title attribute of the images anchor tag.

read more

Attachment window hide buttons and input fields

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will allow you to hide buttons and input fields within the media attachment window.

read more

Restrict uploads to specified file types only, jpg, gif

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will allow you to restrict uploads to an array of specified mime types only. This sample only allows jpg and gif images, adding a new line for png eg: ‘png’ => ‘image/png’, would then allow png images.

read more

Remove all images from the_content in a post

wordpress snippet

Adding this snippet to your wordpress template index.php replacing the default the_content(); will remove images from the post. This is a great snippet if you want to display a number of images on single.php but not on the main blog view. Keep in mind that this will not remove the captions so don’t insert the images with a caption or disable all captions.

read more

Linking to all image sizes Flickr style

wordpress snippet

Adding this snippet to your wordpress theme will automatically link to all image sizes. Add the first snippet to the functions.php of your wordpress theme. Then add the second snippet to the image.php or attachment.php template of your wordpress theme.

read more

Completely disable the image captioning system

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will completely disable the image captioning system.

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