Adding a hyperlink to logo
-
Hi,
I can’t find the site_url or any code mentioned in the header.php file for hestia to change the hyperlink on the site logo to a different external site.
I can’t find any info online on how to do this in the hestia theme.
Could someone please advise me on what code I should be changing and in which file this code resides
-
Hi nathanleeman,
To change the link on the logo then first back up the file header.php, then edit the file header.php, then search for the line:
<a href="<?php echo site_url(); ?>"><img src="<?php header_image(); ?>" alt="<?php bloginfo('name'); ?>" /></a>See the bit that prints the site_url, you’re going to change this bit and hard-code the new url.
<a href="http://www.mynewlink.com"><img src="<?php header_image(); ?>" alt="<?php bloginfo('name'); ?>" /></a>In the example above I hardcoded the link to ‘http://www.mynewlink.com’ – you’ll replace that with the link to your preferred page.
Keep a note of this change, you’ll need to make it each time you refresh the theme.
Hi Taran,
I can’t see this link.
This is the following code I have in the hestia header.php file.
Please advise on how I can do this.
Help very much appreciated.
<?php
/**
* The template for displaying the header
*
* Displays all of the head element and everything up until the page header div.
*
* @package Hestia
* @since Hestia 1.0
*/
$wrapper_div_classes = ‘wrapper ‘;
if ( is_single() ) {
$wrapper_div_classes .= join( ‘ ‘, get_post_class() );
}$layout = apply_filters( ‘hestia_header_layout’, get_theme_mod( ‘hestia_header_layout’, ‘default’ ) );
$disabled_frontpage = get_theme_mod( ‘disable_frontpage_sections’, false );
$wrapper_div_classes .=
(
( is_front_page() && ! is_page_template() && ! is_home() && false === (bool) $disabled_frontpage ) ||
( class_exists( ‘WooCommerce’ ) && ( is_product() || is_product_category() ) ) ||
( is_archive() && ( class_exists( ‘WooCommerce’ ) && ! is_shop() ) )
) ? ” : ‘ ‘ . $layout . ‘ ‘;$header_class = ”;
$hide_top_bar = get_theme_mod( ‘hestia_top_bar_hide’, true );
if ( (bool) $hide_top_bar === false ) {
$header_class .= ‘header-with-topbar’;
}?><!DOCTYPE html>
<html <?php language_attributes(); ?>><head>
<meta charset='<?php bloginfo( ‘charset’ ); ?>’>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”profile” href=”http://gmpg.org/xfn/11″>
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
<link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>”>
<?php endif; ?>
<?php wp_head(); ?>
</head><body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div class=”<?php echo esc_attr( $wrapper_div_classes ); ?>”>
<header class=”header <?php echo esc_attr( $header_class ); ?>”>
<?php
hestia_before_header_trigger();
do_action( ‘hestia_do_top_bar’ );
do_action( ‘hestia_do_header’ );
hestia_after_header_trigger();
?>
</header>TRY THIS METHOD
NOTE: Make Sure to Backup First
Go to Theme Editor>>inc>>view>>main>>class-hestia-header.php>>Line 233>>
ORIGNAL
<a class="navbar-brand" href="<?php echo esc_url( home_url( '/' ) ); ?>"CHANGE TO
<a class="navbar-brand" href="https://www.yourdomain.com"Hope This Would Help and Works.
Hi Taran,
I am still not able to find any of those lines of code.
Please advise where exactly I should be finding this code.
Thought all installs of hestia are the same?
Nathan
This is the only text that I have in the header.php file:
<?php
/**
* The template for displaying the header
*
* Displays all of the head element and everything up until the page header div.
*
* @package Hestia
* @since Hestia 1.0
*/
$wrapper_div_classes = ‘wrapper ‘;
if ( is_single() ) {
$wrapper_div_classes .= join( ‘ ‘, get_post_class() );
}$layout = apply_filters( ‘hestia_header_layout’, get_theme_mod( ‘hestia_header_layout’, ‘default’ ) );
$disabled_frontpage = get_theme_mod( ‘disable_frontpage_sections’, false );
$wrapper_div_classes .=
(
( is_front_page() && ! is_page_template() && ! is_home() && false === (bool) $disabled_frontpage ) ||
( class_exists( ‘WooCommerce’ ) && ( is_product() || is_product_category() ) ) ||
( is_archive() && ( class_exists( ‘WooCommerce’ ) && ! is_shop() ) )
) ? ” : ‘ ‘ . $layout . ‘ ‘;$header_class = ”;
$hide_top_bar = get_theme_mod( ‘hestia_top_bar_hide’, true );
if ( (bool) $hide_top_bar === false ) {
$header_class .= ‘header-with-topbar’;
}?><!DOCTYPE html>
<html <?php language_attributes(); ?>><head>
<meta charset='<?php bloginfo( ‘charset’ ); ?>’>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”profile” href=”http://gmpg.org/xfn/11″>
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
<link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>”>
<?php endif; ?>
<?php wp_head(); ?>
</head><body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div class=”<?php echo esc_attr( $wrapper_div_classes ); ?>”>
<header class=”header <?php echo esc_attr( $header_class ); ?>”>
<?php
hestia_before_header_trigger();
do_action( ‘hestia_do_top_bar’ );
do_action( ‘hestia_do_header’ );
hestia_after_header_trigger();
?>
</header>Where else should I be looking??
Got it thanks!!!!!!!
Issue sorted with Taran’s second suggestion
Great! Best of Luck with Your Website ❤️
The topic ‘Adding a hyperlink to logo’ is closed to new replies.
