Created
April 13, 2016 02:18
-
-
Save chrisguitarguy/826ec6d152289936dae0547fbcaa91dc to your computer and use it in GitHub Desktop.
WordPress ribosome example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Child theme's function.php. This is loaded *before* the parent theme's so you can | |
| * unhook things here as you wish. See: https://github.com/WordPress/WordPress/blob/e9dbea9aac6300550f1637cda24948df65752a68/wp-settings.php#L366-L369 | |
| * | |
| * STYLESHEETPATH === child theme path | |
| * TEMPLATEPATH === parent theme path | |
| * | |
| * For example, in Ribosome https://wordpress.org/themes/ribosome/ say you didn't like the way | |
| * it handled the custom header integration. Unhook it's version, hook in your own. | |
| */ | |
| // priority, the last argument here, means your hook fires before ribosomes | |
| // which is important because.... | |
| add_action('after_setup_theme', 'you_yourtheme_setup', 9); | |
| function you_yourtheme_setup() | |
| { | |
| // ... you need to unhook the ribosome custom header callback from `after_setup_theme` | |
| // it was hooked in at priotity 10, the default. | |
| remove_action('after_setup_theme', 'ribosome_custom_header_setup'); | |
| add_theme_support('custom-header', [ | |
| // your args... | |
| ]); | |
| /* Ribosome should have done this to make your life easier | |
| add_theme_support('custom-header', apply_filters('ribosome_custom_header_args', [ | |
| // ... | |
| ])); | |
| So you could hook into it and change things. | |
| add_filter('ribosome_custome_header_args', function (array $args) { | |
| // change stuff | |
| return $args; | |
| }); | |
| */ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment