0

I building a child theme for 'Responsive Theme' from Cyberchimps. I would like to change one hook. So I guess I need hooks.php file in my child theme. So I copied it from the parent. I made the same hierarchy (I guess this is the right approach).

wp-content/[my_child_theme]/core/includes/hooks.php

Copying file to theme root didn't help.

I also tried to just recreate this critical hook. I put the code in my child functions.php file, but It's also not working, because hooks happen after the theme stuff (just my asumtion).

So the question is simple: how to override parent theme's hook.php file?

0

hooks.php is not a file that belongs to any native WordPress convention. While copying files from parent theme is often mentioned as a technique it only applies to template files, which are part of template hierarchy (native or properly customized one).

Your guess that this is issue of timing is probably accurate. It's a little counter-intuitive but child theme is loaded before parent theme. So running code on child theme load is too early to affect anything that hadn't yet happened.

You need to create a function that will run that code and find a good timing for it to be hooked to. after_setup_theme hook might fit, but really specifics completely depend on timing of what parent theme is doing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.