Every week I try to sit down and update some of my old WordPress functions, to ensure they meet the latest WordPress coding standards and are in keeping with the best practices. If you ever find a piece of code on thisismyurl (or in any of my plugins) that you feel can be improved, please feel free to fork the code or send me suggestions! In the mean time, here’s what I fixed this week:
Getting WordPress Content Outside the Loop
This function allows you to fetch the_content() without being in a loop.
Generate Tags for Posts without Tags
Tags are useful for a lot more than just SEO, and this little function loops through your posts (25 at a time) to ensure all your posts have tags associated with them. I use it on newspaper websites but it can be used on all WordPress sites well.
Get a quote from a directory
This is an old snippet, and after learning as much as I have I’d likely never code a site like this again but it’s still an interesting concept that can be easily adapted to load images or text for a specific day.
Remember, if you’re not comfortable adding this code to your WordPress theme function.php file, you can also create a site specific plugin for your site.