Change the Text of Reset Password Email

September 25, 2016 (3 years ago)
WordPress, PHP, Functions

Send a custom message to users who request a password re-set:


Debugging Scripts in the Console

June 29, 2015 (5 years ago)
PHP, Functions

The easiest way to see what data is being used inside a script. Add this script to your page (or in functions.php for sitewide use).

Then call it inside your function like this:

Then just look at your console log to see the output.

Hint: if you are tracking one variable through a script and want to see how it changes, try something like this:


Embedding a Video in a Template File

January 11, 2015 (5 years ago)
WordPress, PHP

Adding shortcodes to template files is a bit tricky. Although [ embed]myvideourl[ /embed] looks like a regular WP shortcode, it’s not handled the same way.

It works just as expected in a content block, but not so in a template file. Here’s the code to embed into the template:

 NOTE: To use this code, you will need to remove the spaces inside the brackets before ’embed’ and ‘/embed’.

Allow HTML in Excerpts

December 9, 2014 (5 years ago)
WordPress, PHP, Functions

By default, WordPress strips all HTML tags from excerpts. To allow them, simply replace the filter that creates the excerpt from your content.

First, copy the default excerpt filter from wp-includes/formatting.php:

 By changing the strip_tags parameters, you can allow whatever tags you want:

Also be sure to change the name of the function. Copy this to your functions.php file.

 Then, replace the default filter with your new one in functions.php:


Custom Post Type for a Menu

August 29, 2014 (5 years ago)
PHP, Plugins

I created this simple plugin for a restaurant to post their menu online.

Here’s the plugin file (put in plugins directory).

It includes categories (for menu sections), and several parameters for each item.

Now here’s the menu category display page. Create a page named “archive-grille_menu.php” and upload to your theme directory. Replace the loop with this code:

(I listed the categories in two columns.)

 Next is the display page for each category:

Remember to change the divs and styling to match your page layout.

 You can see this plugin in action at:



Social Share Buttons Without a Plugin

July 1, 2014 (6 years ago)
WordPress, PHP

Most sharing plugins are too loaded with options, and tend to slow down my sites.

I wrote this simple script to counter that.

Create this file and name it “sharebuttons.php”. Upload it to your theme directory.

You will also need to create your images, and style the div as you like.

 Then, to add the div to pages or posts, just put this in your template file, immediately following (or just before) the_content() — or wherever you want the buttons to appear:

Custom Admin Page

July 1, 2014 (6 years ago)
WordPress, PHP, Functions

I use these for those occasions when I need to store specialized information in non-WordPress tables. (Such as orders in a custom shopping cart I built.)

It’s also handy for adding informational or instructional pages to the Dashboard.

This adds the page to the WP admin menu (put in your functions.php file):

 The page itself ( lt_orders.php ) resides in the theme folder, and is a simple PHP page, with any functionality you like. It doesn’t need any header or footer calls because it is rendered inside the admin.

Front End Login Form

June 20, 2014 (6 years ago)
WordPress, PHP, Functions

So many times clients (and their members) want to login on the front end. Simple to add this in the header, or sidebar. Style as you wish.

Put this in your header template (or anywhere else you want the form to appear.)


Upload and Rename a File

June 20, 2014 (6 years ago)
PHP, Functions

I have a couple of applications where users need to upload files regularly, and have them renamed and placed into a specific directory. (These applications run independently from WP, so this is just straight PHP.

The form:

 The processing page:


Skip to toolbar