The Thinkery Author
Published: July 13, 2026
Read: 3 min
In: Ideas & Tech

Were you to call a gardener to come round and tidy the garden, you’d give them instructions such as “mow the lawn, dig out weed clumps, then use my long-handled shears to trim grass overhanging the edges”. These seem clear, but they’ve omitted something crucial. Where should the gardener find the mower, the trowel, and the shears? In their van; in your shed; or somewhere undefined amongst bits of DIY kit in the garage? I faced a similar situation when writing the script described in “How to Bulk-add Gigs in an AudioTheme Theme”. I solved it with Justyn’s Magic Includer, a.k.a. The Ultimate Include/Require Script for WordPress by Justyn Hornor.

The analogue to tools in a program is “functions”: self-contained pieces of code that perform an action or return data, possibly the result of a calculation. In my script, these include classes(), which returns the names, times, days and venues for the teacher’s classes; terms(), which returns the three parts of each year when these classes take place; is_in_term(), which works out whether any given date falls within a specified term; and add_class(), which adds all the classes of a given type to the gig listing. These are tools I’ve made.

But they depend on other people’s tools. My function add_class() wouldn’t work unless it could call the functions written by AudioTheme for inserting gigs. And because gigs are represented as posts, those wouldn’t work unless they could call the functions written by WordPress’s authors for handling posts. So when I’m running my programs, I need them to know that AudioTheme’s functions are in the shed over there, whereas the WordPress functions are buried at the back of my garage behind that pile of motorbike spares. This is what Justyn’s Magic Includer does. It enables code to run and have access to all the WordPress functions, even though I’m running it at a terminal rather than by clicking WordPress buttons or menus.

To use it, download his script or copy the one below. Then just load it into PHP before the other code you want to run.

 'Administrator'
               , 'fields' => 'all_with_meta'
               );

  $query = get_users( $args ); 
  // Use the get_users call.

  echo '' . "\n";
  echo '' . "\n";
  // Start the table.

  foreach ( $query as $query ) {
    echo '' . "\n";
  } 
  // For each of the admins, make a table row.

  echo "
Nice NameEmail
' . $query->user_nicename . '' . $query->user_email . '
\n"; // Close the table. } ?>

Here’s a demo. I ran it interactively, but my interactive PHP turns out to be the so-called “Interactive Mode” rather than “Interactive Shell”. This is explained at “Interactive shell ¶” on php.net . It means that even though I’m running the code from the terminal, PHP doesn’t execute the commands until I type an end-of-file. So below, I include Justyn’s Magic Includer and then run his test. This generates a table of the admin users and their email addresses, but doesn’t do so until I type end-of-file, shown as ^D.

jenny@onza:~/www/www.danceanddare.co.uk$ php -a
Interactive mode enabled

php > include('justyn.php');
php > justyn_test();
php > ^D
Nice NameEmail
Jocelyn[email protected]
Jennymailto:[email protected]
jenny@onza:~/www/www.danceanddare.co.uk$

And here’s the table as rendered by your browser:

Nice Name Email
Jocelyn mailto:[email protected]
Jenny mailto:[email protected]

Join the Discourse