WordPress ScrollTo Hash

October 31, 2017 (2 years ago)
WordPress, JS

I needed to pass a hash, and scroll to the matching anchor on a new page.

Not as easy as it sounds in WordPress. (Pretty permalinks make it not work.)

After much testing and research, here’s the solution that worked best:

I added the “-150” after the offset to show the header above the anchor.

WooCommerce – Conditional Ship to a Different Address Selection

October 31, 2017 (2 years ago)
WooCommerce, WordPress, JS, Functions

The scenario is this:

The site has multiple shipping methods (multiple client locations, and the option to ship to “Other”.)

I wanted to show the address panel if “Other” location was chosen, and hide the “Ship to Another Location”  option heading on the shipping page if a client location was chosen.

None of this was strictly necessary, but it makes for a smoother customer experience.

This went into my functions.php file.

Then, this is the hide_ship_to.js script file. (uploaded to the theme directory)


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:


Remove WP Version Number

September 23, 2016 (3 years ago)
WordPress, Best Practices, Functions

Prevent robot scrapers from easily finding out which version of WordPress you’re running.

Not a substitute for keeping WP updated, but a handy fallback for clients who may not.


List all Posts

August 4, 2016 (4 years ago)

Outputs a single list of all your posts.

Thanks, Mickey! (Edited a bit for simplicity)

Adding Content to the Admin Edit Screen

October 30, 2015 (4 years ago)
WordPress, Functions

When creating custom post types, you often need custom fields for them. In the past, your options were “normal” or “side” with priorities. Depending on what else is displayed on your edit screen, these boxes could vary in where they appeared.

And sometimes you just need to add a comment or note to the edit pages.

Good News! We now have new hooks to place them precisely:

Here’s an article that explains the usage: https://make.wordpress.org/core/2012/12/01/more-hooks-on-the-edit-screen/


Append Item to Nav Menu

July 8, 2015 (5 years ago)
WordPress, Functions

Programmatically add an item to any menu that is called with wp_nav_menu.

Thanks, Micah Wood! https://gist.github.com/wpscholar/1249995

Remove Emoji Support from WordPress 4.2

May 19, 2015 (5 years ago)
WordPress, JS, Functions

4.2 added the ability to use Emojicons in WP posts. If you don’t use them, you can remove the (unnecessary) scripts this adds to the header on all your site pages. Here’s the code for your functions.php file:

 Thank you, Paulund!


The Current Template Name

March 3, 2015 (5 years ago)

This will output the name of the template being called on any particular page or post or archive.


Include page content in another page

March 3, 2015 (5 years ago)

Here’s a quick and easy way to include content from one page into another:


Next »

Skip to toolbar