Is *AMP-stack web [design and] build is what you do? [Hacking WordPress!] You need a local dev environment. You need and want your dev environment to be a fuss-free, stable, reliable and long-term partner. The thing about the options I’ve… Continue Reading →
You have a multidimensional array where the elements’ keys/values are each on their own line. You want to remove all elements that have the same key.
Another should-know-this-already snippet of PHP know-how… PHP will not include any line breaks immediately after a closing PHP tag. If you need or want to preserve white space in your rendered HTML code you’ll need to add a space in… Continue Reading →
D’oh. Still a PHP noob after all… Despite NULL and FALSE meaning different things – they’re equal in PHP if you’re not type matching. ref http://stackoverflow.com/
Thanks to this post “Dynamic variable names in PHP” for enlightening me on how easy this is. There’s a lot of stuff out there about PHP variable variables but if you just want to craft a variable’s name based on… Continue Reading →
As I’m still an idiot when it comes to media queries and mobile devices and can pass this stuff on to other folks – but needed to give myself and the interested parties a visual representation of how different sized… Continue Reading →
Q. Want to get something in your theme to work with data from a particular page or post – but don’t know for sure what that post’s ID is? A. Try this in your functions.php file: …then you can then… Continue Reading →
I’m used to using php variables set in included file being used in another included file if all are included in the same document. This doesn’t work in WordPress theme parts. It’s easy to overcome though… you just need to… Continue Reading →
Q. Got a theme that needs two different excerpt lengths? A. Found here: set the standard, longer excerpt as normal in the functions.php file and the override locally using this code:
Easy solution to this basic HTML coding need posted over at Stack Overflow by a random clever bloke. Thanks RCB. My only issue was with UTF-8 characters coming through garbled. Bodged a workaround using this encode entities plug-in for Dreamweaver.
The last time I tried to render CSS through PHP was many, many moons ago. I didn’t work and I couldn’t figure it out. Yesterday I tried again and found out why… the MIME type must be set as text/css…. Continue Reading →
Websites are a point of contact – and a contact form that sends an email is the way to normally handle enquiries. (Of course phone numbers/addresses must first be easy to find!) A contact form requires a web server to… Continue Reading →
Again, this is for one my current projects: my mate Phil’s digital DJ tips site… OK – so there’s loads of plugin’s out there that do this kind of thing but I’m not after anything fancy (or bloated), I’m happy… Continue Reading →
[ This post is now largely if not entirely redundant now thanks to WordPress 3 menu options ] Problem: WP titles are too long to fit in your navigation. Solution: Make the title short enough to fit in the navigation… Continue Reading →
I couldn’t get PHP to accept an HTML file include as the definition of a variable without throwing my templated page into disarray. An answer came from the venerable desilva then checked with the php folk; use output buffering (see example… Continue Reading →
When I moved over to Mac OS X 10.6 last week I found I had to fix my MAMP stack. My old MAMP install didn’t work anymore as unfortunately Marc Liyanage’s excellent PHP package fails in 10.6. The following instructions… Continue Reading →
I’ve been hacking somebody else’s CMS (without access to the main engine) and needed to calculate a mathematical function on some prices. Specifically needed to display a percentage drop when given an original price as well as the current price…. Continue Reading →
UPDATE: I’ve upgraded to Snow Leopard (Mac OS X 10.6) and the following instructions are no longer entirely valid as Marc Liyanage’s PHP package hasn’t been upgraded to work in the Snow. Want to get MAMP on Mac OS X… Continue Reading →
Do you have a web server and a development server rendering different versions of the $_SERVER[‘DOCUMENT_ROOT’] superglobal? Mmm, me too. I’d have pulled my hair out if I had any. Made me feel rather defeated after thinking I’d fixed things… Continue Reading →
It was a while ago that I first read ALA’s article on how to craft a more useful 404 error message. Yesterday implementing a more useful 404 hit the top of my to-do list. In the end I found a… Continue Reading →
[Update – see here. I wouldn’t recommend the Apple PHP distro anymore as it has shortcomings. Roll your MAMP!] See full description for PHP here, for activating SSI here. Add PHP with debugging Activate: goto /private/etc/apache2/httpd.conf and uncomment LoadModule php5_module… Continue Reading →
I had been using a JavaScript solution from javascriptkit.com to randomly show one option from a series on a page. All the options are wrapped in DIVs and placed in a single include file. This first solution used JS to… Continue Reading →
Mine’s just fine now. When trying to upload a photo via WordPress’ interface I used to get this error: Fatal error: Allowed memory size of 8388608 bytes exhausted Couldn’t find a quick fix and worked around it using Flickr until… Continue Reading →
© 2007-2024 qreativbox / Gabriel de Kadt — Powered by WordPress
Qreativbox Hack of Baskerville — Up ↑