I just had to come up with a quick bit of .htaccess code to very basically protect PDFs on a client’s site from being downloaded by people who aren’t logged into WordPress. I thought I’d share the code, specifically to highlight the way to detect if someone’s logged into WP through Apache’s directives.

Archive for the category ‘WordPress’
Detecting WordPress login via htaccess
Better WordPress pagination

UPDATED 6/6/09: Added query string to work with search pagination.
Ever wanted to have better pagination controls in WordPress? Those “Newer posts / Older posts” links are a bit limited. Much better is the ubiquitous numbered list, a la Google’s results page.
WordPress hacks and tips: Spam
Spam is the bane of bloggers. The internet may yet be rendered close to useless thanks to the deadly combination of the low-cost, high-volume mechanized advertizing it facilitates and our culture’s emphasis on consumption and competition.
Still, we’re not going to make it easy for them.
The best WordPress plugins
Not having a list of favourite plugins on a WordPress-related blog is like not having a cute picture of your cat on your personal blog. Also, plugin developers deserve as much credit as possible! (I’m sure they appreciate donations, too ;-)
So, with thanks to all these generous developers, here’s my run-down. I’ve highlighted the ones that I include by default with the majority of my WP installations.
WordPress hacks and tips: Security
I well and truly cut my WordPress security teeth last year when my server got hacked. I summarized my lessons learned in that post, but the post also included a lot of things specific to the attack I was subject to. I thought I’d round up my WP security measures here for easy reference.
There’s many, many things you can do to secure WP. I’ll give links for further reading at the end. Documented here are my “baseline” measures that I make sure are in every WP deployment I create.
WordCamp UK 2009
Given my increasing use of WordPress for fun and profit, when I saw a notice for WordCamp UK 2009, I thought I should sign up.
WordCamps are informal conferences revolving around everything WordPress. This year’s UK gathering is on the weekend of 18-19 July 2009 at the Future Inn, Cardiff. Seems like a great opportunity to catch up on the latest ideas, and to meet people. I much prefer socializing offline… Maybe see you there?
WordPress hacks and tips: Media
First off, hi to anyone who’s been reading my occasional posts here. I’ve just redesigned my site and I’m hoping to blog here a little more regularly. I’ve opened up the comments, so please say hello; I’m especially interested in anyone else working on similar things in WordPress who has ideas to add to my own.
I’m going to post a series of collections of code snippets and tips from my recent work with WP. I’ll try and group them together logically, though I’ll certainly end up with a “bits and bobs” post. I’ll also try and keep each post updated as I learn new stuff.
Many of the tips come from my current habit, when developing custom WP themes for clients, of minimizing plugins. If I can add a bit of code to functions.php rather than install a plugin, I’ll often do the former. Plugins are of course fantastic for more complex modifications, or for offering specific hacks to people who aren’t comfortable editing their theme’s PHP. But if neither of these apply, and the modification is very simple, it seems that it’s worth just slipping the code into your custom theme. Many of these snippets are just included in my default theme “skeleton”, which I edit as necessary for each project.
I should also stress that not all of these are results of my own ingenuity. I’ll credit people where possible, but often I’ve forgotten the source of the code.
OK, without further ado, here’s some media-related stuff.
Tweaks for WordPress Subscribers
I’m currently building a WordPress site where I want people to be able to sign up as Subscribers. They won’t have the option to write anything to the site, so they won’t be Authors or Editors—Subscribers seems appropriate.
I’ve ended up having to tweak WordPress in several ways to make the system work as I want. At the moment I’m erring on the side of coding minor adjustments into my custom themes. Plugins are more flexible, but if you just need to change a small thing, coding it into the theme leaves your site with less overhead from another plugin being loaded.
So, here are a few little plugin-free techniques for tweaking you WP Subscriber system.
Multi-WordPress: Not as easy as it seemed
I’ve deleted the previous post that I just did about running multiple WordPress installations from the same set of core files. Seems it’s a little trickier to get what I wanted than I first thought.
If you’re still wanting to plug away at solving this, multipleblogsonasinglewordpressinstallation.com is still very useful. But also check out Ryan McDonnell’s post on the same subject, and read the comments.
In my now abandoned post, I did neglect the fact that WordPress was including files based on the ABSPATH constant in my wp-config.php, which I thought I could keep in one place with a switch/case for database settings. Big mistake!
But, there were other issues too for me. So, given that 2.7 has auto-upgrade built-in, I’m making the decision to go and fry bigger fish. I might revisit this; if you’re trying, good luck!
WordPress security
My server was recently subject to a hack attack. In some senses it was pretty serious—many new files containing malicious code, many altered files, new bogus admin accounts in WordPress. But in the end it seems I lost no data, and none of my sites got injected with spam links (which I gather was the intent of the hack).
Needless to say, I’ve been forced to quickly learn a lot about web security, and I’ve been grateful to be forced to do so without major losses. I’ll try and document some useful things I’ve learned here.
NOTE: This post contains some good WordPress security tips, but in response to a specific hacks. For a more general, comprehensive run-down of solid WordPress security measures, see this post.
Welcome! I build websites - mostly based on the brilliant, free & open 