Daniel Strunk

Custom frontend routing and loop options for WordPress

This post by Si digital recently detailed their company’s process for using WordPress in a pretty cool way. See, they wanted to continue using WordPress’s admin backend, because it’s user-friendly, people are familiar with it, and existing systems might depend on it. But they found that WordPress’s frontend left something to be desired—they frequently needed more information than The Loop could provide, and in a more succinct manner. I went ahead and went a bit further with Si digital’s idea—incorporating PHP’s Slim framework into Si Digital’s class, allowing for custom routing completely independent of WordPress’s permalink structure. I’m calling the marriage of these two ideas (all tongue-in-cheek punnery intended) WP Loupe.loupe WP Loupe is an extremely simple bit of code that hijacks the WordPress initialization with its own similar init, instantiating a class that can be used to call any function outside of traditional WordPress functions. The folder structure is similar to a more opinionated framework (ahem Rails cough), for ease of maintenance. I’ve got some ideas moving forward, including incorporating a more robust controller and including a PHP templating framework. If you enjoy the WordPress admin structure, but find using the loop a bit painful for some of your more nontraditional WordPress projects, check out WP Loupe: WP Loupe