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 »
Posts Tagged: php
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 »
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 »
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.
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.”
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.
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 »
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 »
Quick snippet to reset all public instance variables inside a PHP class back to their original values. Can’t take credit for the code though. Found it on a website somewhere and have used it in pretty much every class I build. Problem is I can’t remember where it was originally.
Needed a break from a larger web app I’m working on and this weekend kicked out a couple of WordPress plugins that I’ve had on my idea file for a while now. The first is called rTwit and lets you embed any Twitter feed you want into a post or page. Most of the Twitter… Read more »