I'm using the Wordpress "Edge" theme. With this theme the site name has H1 tags and I would like to remove them. See on https://www.archlogo.com/ the site name under the triangular logo. The problem is that those tags are in the functions.php file and I don't know how to use it (I don't know anything about PHP and how to override parent theme functions). Here is a part of the code in the function.php including the H1s :
/******************* Edge Header Display *************************/
function edge_header_display(){
$edge_settings = edge_get_theme_options();
$header_display = $edge_settings['edge_header_display'];
if ($header_display == 'header_text') { ?>
<div id="site-branding">
<?php if(is_home() || is_front_page()){ ?>
<h1 id="site-title"> <?php }else{?> <h2 id="site-title"> <?php } ?>
<a href="<?php echo esc_url(home_url('/'));?>" title="<?php echo esc_attr(get_bloginfo('name', 'display'));?>" rel="home"> <?php bloginfo('name');?> </a>
<?php if(is_home() || is_front_page() || is_search()){ ?>
</h1> <!-- end .site-title -->
<?php } else { ?> </h2> <!-- end .site-title --> <?php }
$site_description = get_bloginfo( 'description', 'display' );
if($site_description){?>
<p id ="site-description"> <?php bloginfo('description');?> </p> <!-- end #site-description -->
<?php } ?>
</div> <!-- end #site-branding -->
<?php
} elseif ($header_display == 'header_logo') { ?>
<div id="site-branding"> <?php edge_the_custom_logo(); ?></div> <!-- end #site-branding -->
<?php } elseif ($header_display == 'show_both'){ ?>
<div id="site-branding"> <?php edge_the_custom_logo(); ?></a>
<?php if(is_home() || is_front_page()){ ?>
<h1 id="site-title"> <?php }else{?> <h2 id="site-title"> <?php } ?>
<a href="<?php echo esc_url(home_url('/'));?>" title="<?php echo esc_attr(get_bloginfo('name', 'display'));?>" rel="home"> <?php bloginfo('name');?> </a>
<?php if(is_home() || is_front_page()){ ?> </h1> <!-- end .site-title -->
<?php }else{ ?> </h2> <!-- end .site-title -->
<?php }
$site_description = get_bloginfo( 'description', 'display' );
if($site_description){?>
<p id ="site-description"> <?php bloginfo('description');?> </p><!-- end #site-description -->
<?php } ?>
</div> <!-- end #site-branding -->
<?php }
}
Do you know how to remove those H1 tags ?
I don't know if this code is the best but it s working:
<?php
function child_remove_parent_function() {
remove_action( 'edge_site_branding', 'edge_header_display' );
}
add_action( 'wp_loaded', 'child_remove_parent_function' );
?>
<?php
function my_parent_theme_function() {
$edge_settings = edge_get_theme_options();
$header_display = $edge_settings['edge_header_display'];
if ($header_display == 'header_text') { ?>
<div id="site-branding">
<?php if(is_home() || is_front_page()){ ?>
<div id="site-title"> <?php }else{?> <div id="site-title"> <?php } ?>
<a href="<?php echo esc_url(home_url('/'));?>" title="<?php echo esc_attr(get_bloginfo('name', 'display'));?>" rel="home"> <?php bloginfo('name');?> </a>
<?php if(is_home() || is_front_page() || is_search()){ ?>
</div> <!-- end .site-title -->
<?php } else { ?> </div> <!-- end .site-title --> <?php }
$site_description = get_bloginfo( 'description', 'display' );
if($site_description){?>
<p id ="site-description"> <?php bloginfo('description');?> </p> <!-- end #site-description -->
<?php } ?>
</div> <!-- end #site-branding -->
<?php
} elseif ($header_display == 'header_logo') { ?>
<div id="site-branding"> <?php edge_the_custom_logo(); ?></div> <!-- end #site-branding -->
<?php } elseif ($header_display == 'show_both'){ ?>
<div id="site-branding"> <?php edge_the_custom_logo(); ?></a>
<?php if(is_home() || is_front_page()){ ?>
<div id="site-title"> <?php }else{?> <div id="site-title"> <?php } ?>
<a href="<?php echo esc_url(home_url('/'));?>" title="<?php echo esc_attr(get_bloginfo('name', 'display'));?>" rel="home"> <?php bloginfo('name');?> </a>
<?php if(is_home() || is_front_page()){ ?> </div> <!-- end .site-title -->
<?php }else{ ?> </div> <!-- end .site-title -->
<?php }
$site_description = get_bloginfo( 'description', 'display' );
if($site_description){?>
<p id ="site-description"> <?php bloginfo('description');?> </p><!-- end #site-description -->
<?php } ?>
</div> <!-- end #site-branding -->
<?php }
}
add_action( 'wp_head', 'my_parent_theme_function' );
?>