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

Exclude pages from admin edit pages list

wordpress snippet

This is a great little snippet that will exclude pages based on the the ID from the admin pages list. Just add this snippet to the functions.php of your wordpress theme and update the array with the page ID’s you wish to hide. Please note this does not stop a post from being editable this snippet only hides the page from view.

read more

Force specific pages to be secure, ssl, https

wordpress snippet

You can easily force specific pages to be secure in wordpress using the following simple little snippet. Just add the following snippet to the functions.php of your wordpress theme and specify the post / page ID desired.

read more

Enable Contact form 7 on specified pages only otherwise wp_deregister_script

wordpress snippet

Like many plugins Contact form 7 adds CSS and Javascript to the head of your HTML document. However like many plugins this is done on every single page regardless if the code is required. Adding this snippet to the functions.php of your wordpress theme will let you enable Contact form 7 only on specified pages.

read more

Hide post view and post preview admin buttons

wordpress snippet

Ever wanted to remove “preview & view” options from the new post and post edit admin screens. Add this snippet to the functions.php of your wordpress theme and don’t forget to update the post type array. Enter any post type you would like to remove the “view and preview” buttons from “custom post type, post, page”.

read more

Generate QR Code for posts and pages

wordpress snippet

Have you ever wanted to generate a Quick Response Code / QR code for a post or page of your wordpress website? Simply add this small snippet to the single.php of your wordpress theme in the location you wish to display the QR. To adjust the size of the QR post / page image just change the following within the src size=100×100.

read more

Check if post / page has a gallery

wordpress snippet

Adding this snippet to your wordpress theme will let you check to see if a post contains the gallery shortcode. Add this code to the single.php template of your wordpress theme inside the loop.

read more