Count all post in a WordPress blog network

Posted by & filed under Blogging, Programming.

Needed this bit of code to keep count of the total number of posts in a network enabled WordPress site. It pulls the list of blogs and the goes through each, gets the post count, and sums it up. Certainly not real efficient, and doubtful you’d want it to run often on a large network…. Read more »

Comparing two SVN branches – thank you TortoiseSVN

Posted by & filed under Programming.

Updating the available pre-release version of ProofBuddy was on my to do list last weekend. A few months ago I wrote a script that pulls a specified version from a subversion tag and packages it up. For the last couple of weeks I’ve been sitting on a beta version to give testers a chance to… Read more »

WordPress script not working from the command line

Posted by & filed under Blogging, Programming.

Spent most of yesterday working on a script that interfaces with WordPress to update posts as it runs. It wasn’t a big part of the script, but it was the part that caused the most frustration. When I was testing locally, I was running the script through a web browser and everything worked perfectly. But… Read more »

Adding WordPress templates to NetBeans

Posted by & filed under Blogging.

If you’ve written more than a couple of WordPress plugins odds are good you’ve copied and pasted the plugin sample readme.txt file into your project. Just sat down to start on my 7th plugin and figured there had to be a better way than Googling for the template, opening it, copying, and pasting. NetBeans makes… Read more »

Quick Fix for OpenX Redirect Loop

Posted by & filed under Computers & Internet.

tl:dr Version Problem is caused by a cookie. Quick fix is to park a different subdomain on top of your OpenX domain and use that subdomain to access admin. Full Version Last week I installed OpenX on my server to use for an upcoming project. After getting it installed and setup admin-side, I went and… Read more »

WordPress recent posts as JSON

Posted by & filed under Programming.

For an update to one of my web projects I went looking for a way to get the recent posts as JSON instead of using the RSS feed. I personally find JSON much easier to deal with than RSS, so that’s the route I wanted to take.

days_ago function for PHP

Posted by & filed under Programming.

Can’t take credit for all of this, but I also don’t remember where the code that I started with came from. days_ago is a function that will take two dates and return a more human friendly version of dates. So if you pass today’s date and yesterday’s date it will return “1 day ago.”

PHP function to get first n words from a string

Posted by & filed under Programming.

A handy little function for your bag of tricks. This PHP function will return a max number of words out of a string, or the whole string if it’s already shorter. This probably could be made shorter, but I was in a hurry when I needed this and went for quick rather than clever.

fsockopen / fgets very slow in PHP

Posted by & filed under Programming.

I’ve been using a PHP class in a project that pulls a URL and then caches the result so it doesn’t have to get loaded again until it’s considered stale. Works pretty well, but every time it went out to get a fresh copy of a page it took forever. I was using fsockopen and… Read more »

Posting to Twitter with PHP and OAuth class

Posted by & filed under Programming.

Needed a bit of an update on a font site I threw up a few years ago. Specifically I wanted to put a script together to tweet a random font each day. Should have been easy since I already had a script that tweeted new fonts, although it’s been a bit behind since I haven’t… Read more »