I’ve been working with WordPress since the dawn of time, and even though I peek at the source code regularly, I still discover new tips and tricks. I’ve compiled my own list of 21 techniques that are handy, clever, fun or best practices rarely followed. I hope everyone finds something new in the list!
1. WordPress Themes Has A Ton Of Built-In Scripts
Using the great wp_enqueue_script() and wp_enqueue_style(), you can include styles and scripts easily with dependency management. But did you know that WordPress has a lot of scripts already built in? jQuery, many elements of jQuery UI, jQuery Form, SWF Object, Tiny MCE, Jcrop and Thickbox are just some the better known ones. The whole list can be found in the WordPress Codex. If you’re interested in learning how to use the enqueue functions effectively, I recommend “The Developer’s Guide to Conflict-Free JavaScript and CSS in WordPress” right here on Smashing Magazine! WordPress Themes
2. Replace Built-In Scripts By Deregistering Them
If you live on the bleeding edge, you can use versions of scripts other than the built-in ones. Using a newer jQuery version is common (though not necessarily good) practice, which can be done in the following way
But do not do this just to brag about using latest stuff. WordPress includes the version of jQuery that it does to ensure maximum compatibility.
Use another version of jQuery only when encountering compatibility issues, such a plugin that specifically requires it.
3. Force Perfect JPG Images
This is a classic example of why working on a team is beneficial. My good friend Lars told me that WordPress doesn’t use 100% quality for images served on the website, to conserve space and bandwidth. He also showed me a solution, of course:
WordPress uses a default quality of 90%. This is fine in most cases; I doubt many people can see the difference. But if top-notch image quality is a must on your website (for a portfolio, photography, etc.), modifying the value might be best.
4. FeedBurner Redirection
FeedBurner is used on almost every blog that I’ve worked on, and yet I never know how exactly to set it up by heart. Thanks to Elio for writing “10 Tips to Optimize Your WordPress Theme,” which contains this snippet
5. Using General Taxonomy Functions
A number of taxonomy functions can handle your custom taxonomies as well as the built-in tags and categories. The Codex’s reference of functions contains the full list of taxonomy functions. I particularly like using get_term(), get_terms() andwp_get_object_terms(). To make things more modular, I use these functions as much as I can, even for tags and categories.
6. Setting Up Sessions In WordPress Themes
Sessions are great for storing information between pages and are widely used on websites. WordPress doesn’t use them at all internally, so the session is never set. Using the following method, you can start a session on all pages before any output.
Note that, while sessions are generally pretty safe, implement IP checking or added nonce protection just to be on the safe side. As long as you’re transmitting non-sensitive data, though, you’ll fine. Check out Mark Jaquith’s great article on nonces for more info.
from : http://www.smashingmagazine.com/2013/09/26/powerful-wordpress-tips-and-tricks/
[quote font=»verdana» font_size=»14″ font_style=»italic» color=»#474747″ bgcolor=»#F5F5F5″ bcolor=»#dd9933″ arrow=»yes» align=»centre»]This Demo Content Brought to you by Momizat Team [/quote]