Category: Snippets

  • Ever since Medium popularized the concept of the read times on articles, I’ve been seeing it as a design element in more WordPress projects. Getting a great estimate for average read time is complicated, but if you just need a…

  • There are a lot of good reasons to require a customer account on checkout: It’s easier for customers to manage their orders and get support. It’s for customer to purchase again (all their details are saved). It’s easier for store…

  • If you have you have a lot of user accounts for subscribers (or customers if using WooCommerce or Easy Digital Downloads), you might find these functions useful for blocking access to the dashboard and simplifying logins.

  • Changing the default markup for comments can be difficult in WordPress. The wp_list_comments function has useful parameters for avatar size and reply text label, but if you want to make more structural changes (like moving the timestamp to below the…

  • In the latest version of Portfolio Press I decided to move all the custom page templates into their own “templates” directory. This helps to organize the files better and simplifies the directory. However, I also needed to build an update…

  • On a recent project we needed to add UTM query parameters (for Google Analytics tracking) to all outbound links to a specific domain. I didn’t feel like updated all the links on the site directly in the code since these…

  • This is a basic example of how to use AJAX in WordPress in the admin area. It shows how to take a variable from javascript, pass it to a PHP function (altering it slightly), and then pass it back to…

  • I added support for Jetpack Infinite Scroll on a theme of mine that uses Masonry recently. Since I couldn’t find any good code snippets or recommendations for how the callback should work I wanted to share a couple methods I…