Tweaking WordPress Image Quality

Optimizing images for use on the web can significantly reduce page load times for image-heavy websites. What many people don’t realize is that WordPress automatically applies a 90% quality level to all JPEG images. This helps to conserve disk space and reduce bandwidth. However, if you are optimizing your images before you upload them, you…… Read More

Adding Dynamic and Piggyback Styling in WordPress

Often, when creating a WordPress theme, some of the theme’s styling will need to be dynamic because it is based on user selections stored in the database. WordPress provides a function called wp_add_inline_style() which allows for inline styles to be loaded after a specific CSS file. For example: add_action( ‘wp_enqueue_scripts’, function () { wp_enqueue_style( ‘custom-style’,…… Read More

Using the wp_list_pluck() WordPress Function

The wp_list_pluck() WordPress function makes it easy to convert an array of items (objects or arrays) to an array of values. It will loop through all the items in the array and replace the item with a specific field value from the item.

Remote WordPress Media Loader

Let’s assume that you have a public website and would like to make a few changes to the code. So, in keeping with best practices, you setup a local development environment on your computer and copy down the code, database and files for the site. However, this particular site has lots of media and the…… Read More

Display a Screenshot of Any Website in WordPress

If you’ve ever wanted to showcase one or more websites on your website, having a screenshot for each one provides a great visual. You can use this code snippet to create a shortcode that allows you to easily drop a screenshot on any WordPress page or post: View the code on Gist. What’s nice is…… Read More

Append Items to A WordPress Nav Menu

WordPress provides a filter called wp_nav_menu_items which allows you to easily append your own list items to a menu. This allows you to do cool things like automatically append an ‘Admin’ link to the end of the footer menu. This is particularly useful when handing off a site to a client and you want to…… Read More

Get All Post Types that Support a Feature in WordPress

WordPress uses post type support to make it easy to manage the feature set for custom post types. Post type support can be defined when registering a post type via register_post_type(), or after the fact via add_post_type_support(). If you would like to remove post type support, you can just use remove_post_type_support(). If you need to…… Read More