New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'hu' functions don't work in child themes #564

ChoccyHobNob opened this Issue Sep 1, 2017 · 1 comment


None yet
2 participants

ChoccyHobNob commented Sep 1, 2017

hu_get_content and hu_get_template_part don't include files from tmpl/ or parts/ in the parent theme or modified versions in the child theme.

hu_is_authorized_tmpl is stopping any files apart from the standard six from being included.

This breaks all the theming. I can create custom post_types but I cannot theme them using the human theme parts.

Some parts of the theme are looking for specific post_types rather than excluding the ones it doesn't want so styles are not applied uniformly either.


This comment has been minimized.


answerquest commented Dec 30, 2017

I found a fix, but had to make it in the parent theme and so will have to edit the parent theme after every update. Hence, requesting the developers to do this small change:

Please make the function hu_is_authorized_tmpl (functions/init-front.php:47) as pluggable, as defined in the documentation.

if( ! function_exists('hu_is_authorized_tmpl') ) {
  function hu_is_authorized_tmpl( $tmpl ) {
    $ct_map = apply_filters(
        array( 'tmpl/index-tmpl', 'tmpl/archive-tmpl', 'tmpl/page-tmpl', 'tmpl/single-tmpl', 'tmpl/search-tmpl', 'tmpl/404-tmpl' )
    //Are we good after filtering ?
    if ( ! is_array( $ct_map ) || ! is_string( $tmpl ) )
    return in_array( $tmpl, $ct_map );

A detailed log of my use case is in the wordpress support forum in this topic.

This will enable child theme users to re-define the hu_is_authorized_tmpl function in their functions.php and hence expand the allowed list to include templates created for custom post types etc.

I also found through this that whlle the the documentation says that the hueman child theme will first look in child theme folder for the file and then in parent theme folder with the only exception being functions.php, this wasn't the case for functions/init-front.php. I had put an edited version in my child theme but hueman directly went to the parent theme. My site's error log proved this:

[30-Dec-2017 16:48:16 UTC] PHP Fatal error: Cannot redeclare hu_is_authorized_tmpl() (previously declared in /..path../wp-content/themes/hueman-tropicsu/functions.php:11) in /..path../wp-content/themes/hueman/functions/init-front.php on line 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment