wordpress snippets last updated   : April 22, 2014
we now have 631 snippets

Enable google docs shortcode for .pdf documents

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will setup [pdf] shortcode to link PDF documents to Google docs online viewer.

read more

Hide posts and pages within the admin from users

wordpress snippet

I have had a few projects that required me to create a page that is for template use only. I may need to add shortcode or something to the page. Now since I don’t want my client to edit this page and possibly break things I hide the pages. Adding this snippet to the functions.php of your wordpress theme will allow you to add id’s for each of the posts or pages you wish to hide.

read more

Add shortcode support to comments

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will enable shortcodes for comments. This code will first remove all shortcodes when it gets to comments and reinitialize only the shortcodes listed within init_common_shortcodes function. I have added in a simple sample shortcode that will grab the users website url and replace the [mysite] shortcode.

read more

Add Google doc’s shortcode for psd, ai, svg, and more

wordpress snippet

On Friday I posted a great snippet by Joen Asmussen the Google PDF shortcode. I wanted to post an updated version primarily because the Google online viewer supports many more file types not just PDF. The supported types are .DOC, .DOCX, .XLS, .XLSX, .PPT, .PPTX, .PDF, .PAGES, .AI, .PSD, .TIFF, .DXF, .SVG, .EPS, .PS, .TTF, .XPS I added a class attribute to the shortcode that you could use to display an icon for the file type link or style the links with the default icon class.

View sample PSD with Google viewer.

read more

Add custom media_buttons for shortcode selection

wordpress snippet

I was looking for a simple way to create a menu for my shortcode items and although you can create tinymce plugins I found it to be a pain. So I decided to create a simplified select menu that would require me to change a little HTML to add new items. Adding this wordpress snippet to the functions.php of your wordpress theme will add a new select menu beside the add media icon. Edit the value= to change the inserted text.

read more

WordPress shortcodes

wordpress snippet

This is the most simple of wordpress shortcodes. Placing [mysite] within your post will be replaced by the hyperlink within the mysite function. Place this code within the functions.php of your wordpress theme.

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