Dave James Miller

Developer. Computer Geek. INTJ.

Page 5 of 12

Using Gravity Forms with WP-Types custom date fields

This is a filter to take Gravity Forms format dates (dd/mm/yyyy) and convert them to WP-Types format dates (integer). Read More

Sort and filter WordPress posts query by a custom field

In this example the event start & end dates are entered as timestamps using WP-Types. It could also be modified for Advanced Custom Fields which uses strings. Read More

Keyboard shortcuts to indent/outdent and format as code in WordPress TinyMCE

This allows you to indent lists/paragraphs in the TinyMCE WYSIWYG editor using Tab, and outdent using Shift+Tab. I wrote it because I write a lot of nested lists, it’s tedious using the keyboard to indent and outdent, and I couldn’t find any… Read More

Sarah’s Rainbow Cake

My sister came to visit and brought me homemade cake!

Insert a post into WordPress from an external script

With wp_insert_post() and wp_set_post_terms()... Read More

Get HTTP redirect destination for a URL in PHP

Makes a HTTP request and read the Location header(s) to determine the redirect destination. Read More

Display WordPress admin area dates in UK English (en_GB) format (day-month-year)

While entering several back-dated posts into a WordPress blog, I got annoyed at the date fields being in American month-day-year format and decided to fix it. Read More

Cyprus 2012

Ten Pin Bowling

Chocolate Birthday Cake

August Bank Holiday in Golcar

Stan the cat meets Becks the dog.

Stan drinking from the bath taps

Firefox – Hide blank icons in bookmarks toolbar

userstyles.org

Also hides the folder icon and shows an arrow instead.

Frogs

Abingdon-on-Thames

Resize an image on the fly with PHP and cache it (like Drupal’s ImageCache)

This script takes an image and resizes it to the given dimensions, then saves that version on the filesystem so Apache can serve it directly in the future. Read More

Store WordPress post password cookies for the browser session only (instead of 10 days)

WordPress saves post password cookies for 10 days, and there is no setting or filter to change that, but you can use this code to replace the form action entirely. Read More

Rain, Rain, Go away!

Magpie Eating Bread

Christ Church College, Oxford

Birds in the Garden

Experimenting with my new DSLR

Olympic Torch, Oxford

Fully restart Ruby on Rails app under Phusion Passenger during Capistrano (cap) deploy

Most instructions for using Capistrano tell you how to make it restart Phusion Passenger by touching the restart.txt file, but this doesn’t immediately restart the app – instead the first person to try to use the application will cause it to be… Read More

Zip a dynamically generated file in PHP

// Generate the contents of the file somehow $content = '...'; // Zip the file $zipFile = tempnam(sys_get_temp_dir(), 'zipfile'); $zip = new ZipArchive; $zip->open($zipFile, ZipArchive::OVERWRITE); $zip->addFromString('sample.txt', $content); $zip->close(); // Do something with the file (e.g. attach it to an email)… Read More

© 2017 Dave James Miller — Powered by WordPress

Theme by Anders NorenUp ↑