PHP Tutorials

  • By
    Preprocess Comment Content in WordPress

    I've put a great amount of effort into making sure the comment system on this blog is fast and feature-filled.  The comment system is AJAX-based so you don't need to worry about page refreshes.  You can also post links to GitHub gists, CodePen pens, and JSFiddle fiddles and...

  • By
    How I Stopped WordPress Comment Spam

    I love almost every part of being a tech blogger:  learning, preaching, bantering, researching.  The one part about blogging that I absolutely loathe:  dealing with SPAM comments.  For the past two years, my blog has registered 8,000+ SPAM comments per day.  PER DAY.  Bloating my database...

  • By
    Prepend and Append Text to WordPress Titles

    I was thinking about little ways to improve my blog and one small enhancement I wanted to make was adding more information to post titles when they show up in RSS feeds.  Something about notifying the user via title outside of the site itself seemed like a good...

  • By
    Prevent Widows with PHP and JavaScript

    One of the small touches you can add to your website is preventing "widows" in your H1-H6 tags.  For those who aren't aware, a widow (in terms of text and headings) means only one word of a title wraps to the next line -- a bit...

  • By
    Remove WordPress Admin Bar CSS

    A version or two back, WordPress decided to add a toolbar for logged in users on the display side that's about the site's theme.  I get why they did it but it's an annoyance to me -- I don't care to see it.  To accomplish this...

  • By
    Add Menu Items to the WordPress Admin Menu

    The existing menus in WordPress are solid but one annoyance is that I need to click "All Posts" and then the "Drafts" link to get to my drafts; I simply want to get there as quickly as possible via the Posts menu. I did...

  • By
    Pygments on PHP & WordPress

    I've been in a long journey trying to find a great code highlighter, I've been using a lot of them that I can't even remember. These are the ones I can remember right now: SyntaxHighlighter Google Prettifier highlighter.js Geshi Right now I'm using highlighter.js but it wasn't exactly what I...

  • By
    Improving Web App Performance With Memcached

    When we think of storage in a web application our first thought is usually a traditional database like MySQL. This is great for long term storage and data analysis, but there's a better option for many short-term needs: memcached. It's a great choice for...

  • By
    Prepend and Append Files with .htaccess

    One of the lessor known and used capabilities of .htaccess files is the ability to prepend and append includes to every page request.  Doing so avoids needing to code <?php require('footer.php'); ?> in every template file you wat to use them in.  Here's the .htaccess code: Now...

  • By
    Sort Objects by Property with PHP

    I recently needed to display a list of authors within a WordPress blog.  The goal was to sort the author list by number of posts before outputting the list.  The method for calculating number of posts isn't a sortable key within WordPress' get_posts, so I had...