The Wordpress Snippet Repository
This snippet is pretty handy if you want to crop your thumbnails instead of scaling them.
You can add as many indiidual image sizes to your WordPress site as you like by using the following function.
This snippet will add a “modify all wordpress site settings” link in the wordpress admin section.
This snippet is very handy if you wish to add category ID to body and post class for ex. targeting CSS styles and such.
If you wanted to add emphasis to the first post in your blog adding this snippet to the functions.php of […]
Heres a little trick on how to add custom user profile fields. Instructions Add this code to your functions.php file […]
Add excerpts functionality to your pages, like in posts.
This snippet add links to the wordPress 3.3 new toolbarst. Instructions Add this to your functions.php file of your theme. […]
Adding this snippet to the functions.php of your wordpress theme will add the search form to your wordpress wp_nav_menu. Don’t forget to update the MENU-NAME to specify the menu you wish to display within, just in case you have multiple menus.
This snippet will add a shortcut link to your Wordpress theme editor.
This snippet will allow your contributors to upload images to your site.
This snippet will alloo contributors to upload images on your wordpress site.
Heres a little tip on how display an author list with Avatars and username. Instructions Add this code anywhere in […]
Create breadcrumbs on your wordpress site without using a plugin.
Adding this to the functions.php of your wordpress theme will change the default mysite.com/author/name to mysite.com/profile/name, however you can change […]
This snippet will allow you to change the default source for your WordPress jQuery files. Instructions Add this code to […]
A quick little snippet to change the standard wordpress login logo to something of your own liking.
This snippet will let you define a custom length of the excerpts output.
This snippet will allow you to define a custom length post title in your template file.
This snippet will change the default style of WordPress admin area by overriding the old stylesheet.
This snippet will help you detect your iPhone visitors and let customize your website and create a better experience for them.
Define one language for the admin section and another language for the end-user theme.
This snippet will disable all dragging of metaboxes within the admin.
This snippet will prevent WordPress from checking if there’s any updates for your plugins. This could be useful if you’re […]
This snippet hides the Worpress version update message that is displayed when there is a new version of WordPress available.
This snippet grabs and displays the number of followers the specified user has.
Here is how to exclude a custom post type from search results.
This snippet will allow you to control which posts or pages there should be excluded from WordPress search results.
This snippet extends WordPress search function to include custom post meta.
You can easily force specific pages to be secure in wordpress using the following simple little snippet. Just add the […]
Heres a little snippet that will display recent posts from a specific category.
This snippet will automatically include all public post types, that have not been excluded from searches in your search results.
If you get this message: “Allowed memory size of bytes exhausted” – it means you have too little memory allocated […]
Did you see other sites link to external posts from their post title? Well that is because it is completely […]
Expose the WordPress “img src” part from the get_the_post_thumbnail, to modify the “img src” syntax. Instructions Add the following code […]
This snippet will allow you to set custom excerpt lengths in your excerpt tag in your template. Instructions Add this […]
If you only wish to show content only on the front page, you can do so by wrapping the content […]
Here a little snippet that will hide the wordpress admin bar from everybody except site admins.
Useful for sites that have public registration turned on.
By default, WordPress compress uploaded jpg images. This is a good thing because it makes the files smaller, but in […]
This snippet is great for the security to protect wordpress against malicious URL requests.
This snippet will help you to redirect login user based on their role.
Heres a little trick on how to remove the author prefix from the author slug. To clarify, this snippet will […]
Here is how to run a cron job on at a specific interval by using Wordpress build in wp_schedule_event() function.
Heres a snipet that allows you to set the permalink settings from the the functions.php file, rather than from the Wordpress admin backend
This snippet will easy let you set your wordpress site offline by using the wp_die. This is a handy and […]
This snippet automatically sets the featured image by fetching the first image of the post.
This snippet will let you create a white-list of terms to include in body_class. This is a great way to filter out many of the unwanted css classes added.
Heres a little trick on how to show a list of the most popular post by post read count – […]
Heres a little nifty snippet that will show the number of queries made and the page load time.
A lot of people use the tag cloud widget in WordPress to show their post tags on their widgetized sidebar […]
Heres a snippet on how to hide the sidebar container elements such as UL – if the sidebar has no widget active..
With this snippet you can create a page template restricted only to those users with the right role to access to it.
This snippet can be used to target code for a specific theme only. A need feature if you want to execute conditional functions on ex. different devices and platforms.
This snippet will add a new column called counts within the admin post listing that will display the total number of pingbacks, trackbacks for each post.
This simple snippet tracks and shows post views in your templates – and without the need for a plugin.
WP-PageNavi is definitely one of the most popular WordPress plugins and in fact, it is very useful. But did you […]
Put this in the theme file somewhere near where you output the_content() (likely in the single.php or page.php file) to […]