Editing header.php

Hello

I do not want to use your builder for the header, I would like to create my own using the header.php however when editing that file there is no way to remove the default theme header that is used. How would I do this?

Thank you

Found it, I just need to remove:

<?php do_action('gust_region', 'header'); ?>

Hey Ashley

Glad you figured something out. Although from the sounds of it, you’re modifying the theme’s header.php file. While this works, it does mean that any changes you make will disappear when you update the theme. There are a couple of other more stable approaches you can take. I’m away from my desk today, but will reply tomorrow with a more stable approach.

Cheers!

Hey Ashely

So what I’d recommend doing is first using a child theme so that you can make any changes without editing the core Gust files. You can find docs on doing so here and there’s a downloadable child theme starter for you on that page too.

Next up, I’d add the following code to start rendering out your own header. You’ll want to do this inside your child theme’s functions.php file.

<?php
class Gust_Child
{

  public static function add_filters()
  {
    add_filter('gust_region_content', [__class__, 'region_content'], 10, 2);
  }

  public static function region_content($content, $region_key)
  {
    if ($region_key === 'header') return self::render_header();
    return $content;
  }

  public static function render_header()
  {
    return '<div>My custom header.</div>';
  }

}

Doing it this way means that when you update Gust, your changes won’t be overwritten by our updates.