Tag Archives: PHP

Convert URLs to Links in a String

Another common function that I get asked for is the ability to highlight links in a block of text that contains urls, but doesn’t have them within anchor tags. So, to stop me hearing this question and advising people to ‘use Google’ here is a function that will do this. It very likely isn’t bullet proof (and isn’t the most elegant thing I’ve ever seen), but will hopefully be either good enough or provide inspiration for your own solution.

PHP Function to Apply Multiple Others…

From time to time I’ll post little snippets of code that I have been asked for, or see requested again and again. One such request is the ability to apply a set of transformations to text (or whatever) again and again without writing them out each time.

Removing WordPress Autosave and Drafts

Another problem with Wordpress that has almost instantly begun to bug me is the autosave ‘feature’ of Wordpress. I simply don’t want it on! There doesn’t seem to be an option, and despite downloading a plugin to fix it ‘Disable Revisions and Autosave’ (by Exper) this doesn’t seem to work anymore in WP 2.8, damn.

Fixing WordPress Code Formatting

As one of my tasks to make this basic blog I had to learn a little about Wordpress (2.71), just enough to get it skinned and get writing. I very quickly came across what I can only assume must be an extremely common problem that expert users face when writing their posts / pages in this excellent platform, text formatting. At first I thought I was doing something wrong. When I swapped between the Visual and HTML views I seemed to lose any <p> tags (and likely countless others) and when I actually viewed the site’s source I had gained <br /> tags… I did what most people do and hit Google for quick solutions, but I couldn’t find anything acceptable.