StudioPress’ Genesis Framework is one of the most popular premium WordPress frameworks on the market. We use it here on this site. Genesis customizations are mostly straightforward but sometimes you come across a tricky one. Here are instructions on how to modify your Genesis powered child theme’s doctype and html element.
genesis_attr filter function for the
The trouble comes when you try to remove the old Genesis doctype. Most, if not all, Google search results for accomplishing this will say it is easy as adding
remove_action( 'genesis_doctype', 'genesis_do_doctype' ); to your function.php file. This is probably true if you are directly modifying the Genesis theme. That is a bad idea for many reasons. Calling that action in your child theme won’t work. The reason has to do with a quirk in how child themes work. From the codex:
functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)
You can’t remove an action that hasn’t been added yet. Thankfully the solution is easy. You need to defer calling the removal until the parent theme has loaded. WordPress’ after_setup_theme hook is your friend here. Wrap the removal code in that hook and you are good to go. Here is a gist documenting the code.