Category: Code

  • Use BraincraftedBootstrapBundle for Twig forms without Assetic compilation

    One of my favourite features of Bootstrap is the form styles, which I’ve wanted to incorporate into various Symfony2 Bootstrap applications I’ve been working on. The BraincraftedBootstrapBundle has a really robust set of styles for Symfony forms but also attempts to throw Bootstrap into Assetic. I’m not a fan of this, I use bootstrap’s SCSS repository […]

  • A modern Composer workflow with WordPress

    Updated on 27th August with different methods for getting WordPress packages This is a guide on how to incorporate a modern Composer workflow into your WordPress builds. This aimed at people who run WordPress websites as a service – typically bespoke theme developers who want to get a bit more out of WordPress as a tool. […]

  • Simple redirect unauthenticaed WordPress users

    Put this at the top of your template you want to restrict: <?php /** * If user’s not logged in, send to login page. */ if (!current_user_can(‘read’)) { header(‘Location: ‘ . wp_login_url(get_permalink())); exit; }

  • Temporarily add WordPress actions and filters

    Quite regularly I need to use a WordPress filter or action for one little snippit of code and return it back to normal. I’ve done this with anonymous functions. It’s a quick and nifty way to get things done without writing things unnecessarily to the global scope. <?php function theExcerpt($length = 55, $more_text = ‘…’) […]