Error loading custom template with App\Template

I am trying to display a few separate template files for a custom post type with custom taxonomies. I know that I can do custom taxonomies-{***}.php. But these taxonomy apply to two different CPT, so I need them separated.

Currently I am here:


    function ($original) {

        global $wp_query;
        $post_type = $wp_query->query_vars['post_type'];
        $taxonomy = $wp_query->query_vars['taxonomy'];

        if ($post_type === 'deals' && $taxonomy === 'deal-spotlight') {

            $base_name = 'archive-' . $post_type . '-' . $taxonomy;
            $template =  App\template($base_name);
            if ($template && !empty($template)) {
                return $template;
        return $original;

The file is named with the blade extension ie archive-{posttype}-{taxonomy}.blade

I am getting this error

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 159744 bytes) in **/vendor/roots/sage-lib/Template/FileViewFinder.php on line 36

Any ideas? Is there a better way?

This topic was automatically closed after 42 days. New replies are no longer allowed.