Tag: php

  • 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 = ‘…’)…