Follow up on closed topic with no resolution

CLOSED TOPIC:
https://theme.co/forum/t/custom-header-view-missing-masthead-content/87952/3

FOLLOW UP RESPONSE:
Hello,

This is unfortunately not helpful as I need to execute PHP code from within the header file. Is there something I’m doing wrong in creating a custom header file via child theme?

Thanks,
Ben

Hi Ben,

I would suggest you the same as my colleague to use the Header and Footer builder to create the header, and on executing the PHP code I would suggest you create a custom shortcode and use that in Text or Raw Content element in the Header nd Footer builder. Please go through the following article on how you can create the shortcode in WordPress.

  1. https://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress
  2. https://pagely.com/blog/creating-custom-shortcodes/

Hope it helps.
Thanks

Hello,

Thanks for the quick response. I just want to confirm, are you saying there is currently no support for custom header files in the Pro theme?

Thanks,
Ben

Hi Ben,

We don’t offer any support on the modification of the theme core files.

Thanks

Hello,

Does this mean child themes are no longer supported as well? I am using the provided child theme from Pro, and I purchased an unlimited license with the understanding that I could build a custom PHP file for the header. I’ve previously done this with Pro theme builds so if you could help me understand what changed and why custom header files are no longer supported that would be appreciated.

Thanks,
Ben

Hello Ben,

The files must have the following contents:

header.php

<?php

// =============================================================================
// HEADER.PHP
// -----------------------------------------------------------------------------
// The site header.
// =============================================================================

x_get_view( 'header', 'base' );

base.php

<?php

// =============================================================================
// VIEWS/HEADER/BASE.PHP
// -----------------------------------------------------------------------------
// Declares the DOCTYPE for the site, includes the <head>, opens the <body>
// element as well as the .x-root <div> and .x-site <div>.
// =============================================================================

$x_root_atts = x_atts( apply_filters( 'x_root_atts', array( 'id' => 'x-root', 'class' => 'x-root' ) ) );
$x_site_atts = x_atts( apply_filters( 'x_site_atts', array( 'id' => 'x-site', 'class' => 'x-site site' ) ) );

?>
<!DOCTYPE html>

<html class="no-js" <?php language_attributes(); ?>>

<head>
  <?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

  <?php wp_body_open(); ?>

  <?php do_action( 'x_after_body_begin' ); ?>

  <div <?php echo $x_root_atts; ?>>

    <?php do_action( 'x_before_site_begin' ); ?>

    <div <?php echo $x_site_atts; ?>>

    <?php do_action( 'x_after_site_begin' ); ?>

What are you trying to insert in the header? You may be adding it in the wrong file. Please provide the HTML code or the script that you need to add to your header so that we can advise you on the proper way of adding it to your site header.

Best Regards.

Hello,

Both files are in place as suggested, and the result is that the <header class="masthead> elements is completely empty. Is there another step involved in creating a custom child theme header file?

Thanks,
Ben

Hello Ben,

It could be that your custom templates were out of place. To better assist you with your issue, kindly provide us access to your site so that we can check your settings. Please create a secure note with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.