I’m working with a child theme for Extra by Elegant Themes to which I’ve added a custom taxonomy. I have modified the layouts.php file (in /includes) to make the theme use its layouts for custom taxonomies as well as category and tag archives.

However, I’ve had to do this by editing the parent theme files, as I can’t find a way to add my changes in via the child theme. This of course means my changes will be lost if the theme is ever upgraded, so it’s decidedly sub-optimal as a solution.

The file is loaded via a require in functions.php:

$et_template_directory = get_template_directory();
require $et_template_directory . '/includes/layouts.php';

The functions I’ve altered within layouts.php are extra_modify_archive_query and is_extra_tax_layout. Unfortunately these functions aren’t declared within if ( !function_exists( ... conditions, otherwise I could just define them in the child theme functions.php.

In both edited functions I’ve simply subsituted is_category() || is_tag() with is_category() || is_tag() || is_tax(). Is there another way to solve this by making the is_category() function return true for custom taxonomies? That would solve my problems as well.

Any ideas on how to solve this properly, without editing the parent theme or WordPress core? Thanks.

Read more here: Overriding /included/layout.php in Extra child theme


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: