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

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

Add class to first post in the loop

wordpress snippet

If you wanted to add emphasis to the first post in your blog adding this snippet to the functions.php of your wordpress theme will add the class of “first” to your first post.

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

Change default ‘Enter Title Here’ for custom post types

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will let you change default ‘Enter Title Here’ for custom post types. You will need to update the POST_TYPE name and default text

read more