php – How to override Avada secondary header template?-ThrowExceptions

Exception or error:

I’m trying to edit Avada’s secondary header because the layout doesn’t suit me. And I’ve tried copying header-secodary.php from the theme’s template folder and adding an edited version to my child’s theme template folder. However, nothing happens.

Then, I tried following a few tutorials online, like this one. But whatever they were doing no longer works in this newer theme version. Because when he says to copy this bit of code from header-(a version of your header).php to functions.php

if ( ! function_exists( 'avada_header_1' ) ) {
    function avada_header_1() {
        if ( ! in_array( Avada()->settings->get( 'header_layout' ), array( 'v1', 'v2', 'v3' ) ) ) {
            return;
        }
        get_template_part( 'templates/header-1' );
    }
}
add_action( 'avada_header', 'avada_header_1', 20 );

What I see in my header-1.php is

<?php
/**
 * Header-1 template.
 *
 * @author     ThemeFusion
 * @copyright  (c) Copyright by ThemeFusion
 * @link       https://theme-fusion.com
 * @package    Avada
 * @subpackage Core
 */

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
    exit( 'Direct script access denied.' );
}
$header_type = Avada()->settings->get( 'header_layout' );
get_template_part( 'templates/header-' . $header_type );

So, I’m lost. Can someone please let me know what I need to do here to make this work? How do I override this? Because just creating a directory with new files in my child theme doesn’t work. And I have no idea how to navigate functions.php file. Thank you!

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *