I edited my WordPress site's header.php file and when I reverted changes my site broke
I edited my WordPress site's header.php file and when I reverted changes my site broke
The problem first appeared because I tried to add a Google tag from Google Ads into my header.php file. That didn't work, so I reverted the changes I made, removing all that I added in, but now the site shows at the top, a line of code that depends on the page where I am in. For example, in the home page:
class="home page-template-default page page-id-2 theme-organic-beauty woocommerce-no-js organic_beauty_body body_style_wide body_filled article_style_stretch layout_single-standard template_single-standard scheme_original top_panel_show top_panel_above sidebar_hide wpb-js-composer js-comp-ver-6.13.0 vc_responsive">
Or in another page:
class="archive tax-product_cat term-sapunuri term-77 theme-organic-beauty woocommerce woocommerce-page woocommerce-no-js organic_beauty_body body_style_wide body_filled article_style_stretch layout_excerpt template_excerpt scheme_original top_panel_show top_panel_above sidebar_show sidebar_right wpb-js-composer js-comp-ver-6.13.0 vc_responsive">
The main menu went missing (login, register, about, etc.) - it was a green bar at the top; also an image disappeared from under where the main menu should've been.
I tried to Ctrl+F some of these in many .php files, including header.php but didn't find where they come from. Furthermore, today, when trying to repair said mistake, I removed a ">", saw it broke the formatting, added it back, and the formatting is still broken. I do not understand why it didn't revert to how it was before. The ">" I removed and added back is in the following code, bolded (in case it doesn't work, it's the second closing one, on the third line:
<body>
<?php body_class(); ?>**>**
<?php wp_body_open(); ?>
<?php do_action( 'before' ); ?>
z <?php get_template_part(organic_beauty_get_file_slug('sidebar_outer.php')); ?>
I also didn't make a backup because the changes were small and I didn't think they would cause this big of a problem. How can I fix this? Can I recover an older version of the file and restore it somehow?
Attaching header.php file below:
<?php
/**
* The Header for our theme.
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?> class="<?php
// Add class 'scheme_xxx' into <html> because it used as context for the body classes!
$body_scheme = organic_beauty_get_custom_option('body_scheme');
if (empty($body_scheme) || organic_beauty_is_inherit_option($body_scheme)) $body_scheme = 'original';
echo 'scheme_' . esc_attr($body_scheme);
?>">
<head>
<?php wp_head(); ?>
</head>
<body>
<?php body_class(); ?>>
<?php wp_body_open(); ?>
<?php do_action( 'before' ); ?>
<?php get_template_part(organic_beauty_get_file_slug('sidebar_outer.php')); ?>
<?php
$body_style = organic_beauty_get_custom_option('body_style');
$class = $style = '';
if (organic_beauty_get_custom_option('bg_custom')=='yes' && ($body_style=='boxed' || organic_beauty_get_custom_option('bg_image_load')=='always')) {
if (($img = organic_beauty_get_custom_option('bg_image_custom')) != '')
$style = 'background: url('.esc_url($img).') ' . str_replace('_', ' ', organic_beauty_get_custom_option('bg_image_custom_position')) . ' no-repeat fixed;';
else if (($img = organic_beauty_get_custom_option('bg_pattern_custom')) != '')
$style = 'background: url('.esc_url($img).') 0 0 repeat fixed;';
else if (($img = organic_beauty_get_custom_option('bg_image')) > 0)
$class = 'bg_image_'.($img);
else if (($img = organic_beauty_get_custom_option('bg_pattern')) > 0)
$class = 'bg_pattern_'.($img);
if (($img = organic_beauty_get_custom_option('bg_color')) != '')
$style .= 'background-color: '.($img).';';
}
?>
<div class="body_wrap<?php echo !empty($class) ? ' '.esc_attr($class) : ''; ?>"<?php echo !empty($style) ? ' style="'.esc_attr($style).'"' : ''; ?>>
<?php
$video_bg_show = organic_beauty_get_custom_option('show_video_bg')=='yes';
$youtube = organic_beauty_get_custom_option('video_bg_youtube_code');
$video = organic_beauty_get_custom_option('video_bg_url');
$overlay = organic_beauty_get_custom_option('video_bg_overlay')=='yes';
if ($video_bg_show && (!empty($youtube) || !empty($video))) {
if (!empty($youtube)) {
?>
<div class="video_bg<?php echo !empty($overlay) ? ' video_bg_overlay' : ''; ?>" data-youtube-code="<?php echo esc_attr($youtube); ?>"></div>
<?php
} else if (!empty($video)) {
$info = pathinfo($video);
$ext = !empty($info['extension']) ? $info['extension'] : 'src';
?>
<div class="video_bg<?php echo !empty($overlay) ? ' video_bg_overlay' : ''; ?>"><video class="video_bg_tag" width="1280" height="720" data-width="1280" data-height="720" data-ratio="16:9" preload="metadata" autoplay loop src="<?php echo esc_url($video); ?>"><source src="<?php echo esc_url($video); ?>" type="video/<?php echo esc_attr($ext); ?>"></source></video></div>
<?php
}
}
?>
<div class="page_wrap">
<?php
$top_panel_style = organic_beauty_get_custom_option('top_panel_style');
$top_panel_position = organic_beauty_get_custom_option('top_panel_position');
$top_panel_scheme = organic_beauty_get_custom_option('top_panel_scheme');
// Top panel 'Above' or 'Over'
if (in_array($top_panel_position, array('above', 'over'))) {
organic_beauty_show_post_layout(array(
'layout' => $top_panel_style,
'position' => $top_panel_position,
'scheme' => $top_panel_scheme
), false);
// Mobile Menu
get_template_part(organic_beauty_get_file_slug('templates/headers/_parts/header-mobile.php'));
}
// Slider
get_template_part(organic_beauty_get_file_slug('templates/headers/_parts/slider.php'));
// Top panel 'Below'
if ($top_panel_position == 'below') {
organic_beauty_show_post_layout(array(
'layout' => $top_panel_style,
'position' => $top_panel_position,
'scheme' => $top_panel_scheme
), false);
// Mobile Menu
get_template_part(organic_beauty_get_file_slug('templates/headers/_parts/header-mobile.php'));
}
// Top of page section: page title and breadcrumbs
$show_title = organic_beauty_get_custom_option('show_page_title')=='yes' && !is_home() && !is_front_page();
$show_navi = apply_filters('organic_beauty_filter_show_post_navi', false);
$show_breadcrumbs = organic_beauty_get_custom_option('show_breadcrumbs')=='yes' && !is_home() && !is_front_page();
if ($show_title || $show_breadcrumbs) {
?>
<div class="top_panel_title top_panel_style_<?php echo esc_attr(str_replace('header_', '', $top_panel_style)); ?> <?php echo (!empty($show_title) ? ' title_present'. ($show_navi ? ' navi_present' : '') : '') . (!empty($show_breadcrumbs) ? ' breadcrumbs_present' : ''); ?> scheme_<?php echo esc_attr($top_panel_scheme); ?>">
<div class="top_panel_title_inner top_panel_inner_style_<?php echo esc_attr(str_replace('header_', '', $top_panel_style)); ?> <?php echo (!empty($show_title) ? ' title_present_inner' : '') . (!empty($show_breadcrumbs) ? ' breadcrumbs_present_inner' : ''); ?>">
<div class="content_wrap">
<?php
if ($show_title) {
if ($show_navi) {
?><div class="post_navi"><?php
previous_post_link( '<span class="post_navi_item post_navi_prev">%link</span>', '%title', true, '', 'product_cat' );
next_post_link( '<span class="post_navi_item post_navi_next">%link</span>', '%title', true, '', 'product_cat' );
?></div><?php
} else {
?><h1 class="page_title"><?php echo wp_kses_post(organic_beauty_get_blog_title()); ?></h1><?php
}
}
if ($show_breadcrumbs) {
?><div class="breadcrumbs"><?php if (!is_404()) organic_beauty_show_breadcrumbs(); ?></div><?php
}
?>
</div>
</div>
</div>
<?php
}
?>
<div class="page_content_wrap page_paddings_<?php echo esc_attr(organic_beauty_get_custom_option('body_paddings')); ?>">
<?php
// Content and sidebar wrapper
if ($body_style!='fullscreen') organic_beauty_open_wrapper('<div class="content_wrap">');
// Main content wrapper
organic_beauty_open_wrapper('<div class="content">');
?>
Link to site: https://elidor.ro/
Edit: text issue fixed (thank you CBroe) Edit: in other pages except for Home, the main menu is showing, however this is probably still from the header file because I tried to restore an older version of Home and it's the same
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand