Tag Archives: Development

PHP for WordPress Talk on WordCamp TV

A couple weeks ago I had a chance to present on PHP for WordPress at WordCamp Baltimore 2015.  Thanks to the good folks who recorded and got everything together to post on WordCamp.tv you can now watch the video of the talk.

Check it out and then head over and learn more about my PHP for WordPress Course at Treehouse ūüôāhttps://videopress.com/videopress-iframe.js

How to Deregister, Unqueue and Unhook a Parent Theme CSS Stylesheet

There comes a time when working with a WordPress project where you want to not include certain CSS from a parent theme or plugin. ¬†For example,¬†a parent theme may include extra stylesheets that you don’t want or a plugin may be adding styles¬†that conflict with your site.

On a recent project, I wanted to remove the parent styles just on a certain section of the site. ¬†Here’s how to do it.

First what you have to do is find the¬†handle for the parent stylesheet you no longer want. ¬†Let’s say for example that we had a twentyfifteen child theme and wanted to remove the parent styling.

You would go to the parent theme’s functions.php file and find the hook. ¬†It can help to search for “wp_enqueue_style” to find the CSS includes faster. ¬†Here is what it looks like in twentyfifteen:

TwentyFifteen Theme Functions.php Including Stylesheet

We can see the handle is “twentyfifteen-style” and this is what we will now use to¬†dehook it using the code below:

function unhook_parent_style() {

  wp_dequeue_style( 'twentyfifteen-style' );
  wp_deregister_style( 'twentyfifteen-style' );

add_action( 'wp_enqueue_scripts', 'unhook_parent_style', 20 );

It’s important that we add this code into a function and then hook the function into wp_enqueue_scripts.

If you only want to unhook the styles on certain pages, you can also add conditional code like this:

function unhook_parent_style() {

  is_page_template( 'custom-template.php' ) {
    wp_dequeue_style( 'twentyfifteen-style' );
    wp_deregister_style( 'twentyfifteen-style' );

add_action( 'wp_enqueue_scripts', 'unhook_parent_style', 20 );

This will only unhook the parent styles when WordPress is loading pages that use the custom-template.php file. You can also use any of these conditional statements as well.

Shout out to Brad Dalton over at WP Sites for the original code snippet on How To Deregister & Dequeue Style Sheets!

A List of Commonly Unknown WP Function

Elliott¬†from Laser Red wrote a round up of helpful WordPress functions that you don’t usually read about:

  1. get_post_field
  2. wp_list_pluck
  3. antispambot
  4. checked/selected
  5. body_class
  6. human_time_diff
  7. wp_send_json_success/error
  8. wp_remote_get/post
  9. get_template_part

If you’re a WordPress dev, I¬†really suggest you check out this article, because he gives an explanation and code example for each one of these in an a quick, easy to read format.


Big thanks to Kate Mag for the Private Only plugin, which allows you to password protect a whole site (like this).

If you use a live development server during your WordPress development, you should check out this plugin. It’s a few steps better than just unchecking the setting that says allows search engines to find this site.