Combine two hobbies into a career.
Combine two hobbies into a career.
On our works web site, we use Contact Form 7, about 30 in all, and after being asked to change the ‘to:’ address once too often, I thought ‘fuck this’ and came up with a solution where the content editors can do it themselves without pestering me all the time.
The quickest way is to simply set a custom field on the page/post you want the Contact Form 7 to appear on. At the bottom of the editor screen, there is the option to Add New Custom Field. For the sake of this tutorial, I’m going to call the key cf_email_to_address and then enter the email address you want to test.
Click Update or Save depending on what you’re doing, and now head over to the Contact Form 7 that you want to edit and in the Form tab, add this at the top:
[dynamichidden recipient-email "CF7_get_custom_field key='cf7_email_to_address' obfuscate='on'"]
This is a CF7 dynamic field that put the value of the custom field cf7_email_to_address that we created above, and puts it into variable recipient-email.
All we have to do now is click on the Mail tab and in the To address, add this:
Will send an email with the post title name to the email address we specified in the custom field.
I was sent this by a developer in the office, from the SASS file for a web app.
/* greys */
Notice the wonderful concise and informative referencing of the classes, easy reference was not top of the priority list I presume. But this is what happens when you are sent PDF’s from the designer.
After my my Mac decided to fuck up after installing Sierra, it gave me a chance to reorganise my shit as I forgot to backup my MAMP Pro installation, so I had to rebuild all 20+ web sites and databases from scratch. Not doing this again as it’s a right pain in the ass.
So after playing around a bit, I’ve moved the htdocs folder and the MySQL databases to Dropbox. I could use iCloud but I’m not installing that shit on my Workstation PC at home.
Before we go to Terminal, make sure MAMP and your MySQL management tool (phpmyadmin/Sequel Pro/Workbench) of choice is closed.
If you want to use another cloud storage solution, here are the default install path for iCloud:
Just replace the Dropbox path in these examples. So let’s copy the databases folder to Dropbox in a folder called MAMP_db.
cp -r /Library/Application\ Support/appsolute/MAMP\ PRO/db ~/Dropbox/MAMP_db
Rename the default folder to something else
mv /Library/Application\ Support/appsolute/MAMP\ PRO/db /Library/Application\ Support/appsolute/MAMP\ PRO/delete_db
Create a symbolic link to the new folder.
ln -s ~/Dropbox/MAMP_DB /Library/Application\ Support/appsolute/MAMP\ PRO/db
Now start MAMP Pro and wait to see if MySQL loads without errors. I double checked by loading Sequel Pro to see if my databases were there.
If you want to use iCloud instead, use
If that was a success, we can now move the web sites.
Exactly the same commands, just a different folder.
cp -r /Applications/MAMP/htdocs ~/Dropbox/MAMP_htdocs
mv /Applications/MAMP/htdocs /Applications/MAMP/delete_htdocs
ln -s ~/Dropbox/MAMP_htdocs /Applications/MAMP/htdocs
Load MAMP Pro and click localhost and hey presto.
I did this on a fresh installation, and when tried to access localhost I got a Forbidden 403 error. All I did was make a new host and it worked fine.
Edited: 18/3/2018 with screenshots and to recognise an update.
Some genius at work pointed out that the contact forms on the works web site weren't validating properly.
Whoops, my bad.
So I changed the email and telephone inputs to their proper HTML5 types, but there was the postcode box that the spammers where filling in with crap, so I wrote this little plugin for Contact Form 7 that adds postcode validation.
Once installed, it adds the Postcode option to the form builder:
Add the usual id, class and required options.
It's free to use and abuse as you feel necessary, just a link back to the original would be nice.
Congrats to MrJoshFisher for adding placeholder support, I LOL'd and LOL'd when that came up 🙂
So we all get our subscriptions through and the first thing I notice is the search.
That’s nice, so my mind is already writing the code in my head, but I’m a lazy shit so can I rip it? Nope, it’s in ReactJS.
This is provided as is. It’s very basic, no responsiveness, no options and written and tested in Chrome. Sure it can be improved greatly, but this was just me messing around more than creating a finished project.
Download it here, add it to your site and activate.
If you want to reconfigure it, you’ll have to edit the files and colours and stuff.
Try the search box on the left hand side on this blog and you’ll see it in action.
I was writing a blog post about some regressive who commented on a podcast and I was just about to insert an image of SJW Bullshit Bingo I found on Google Images when I thought “there must be a better way of doing this?”
So a few minutes later I had a jQuery version up and running.
So play along while watching some shite from Laci Green or MTV Decoded.