I'm using the Flatsome theme and I want the website main logo to point to another link not the homepage, can somebody help me please? Here is my header.php
Thank you
<!DOCTYPE html>
<!--[if IE 9 ]> <html <?php language_attributes(); ?> class="ie9 <?php flatsome_html_classes(); ?>"> <![endif]-->
<!--[if IE 8 ]> <html <?php language_attributes(); ?> class="ie8 <?php flatsome_html_classes(); ?>"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html <?php language_attributes(); ?> class="<?php flatsome_html_classes(); ?>"> <!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php do_action( 'flatsome_after_body_open' ); ?>
<?php wp_body_open(); ?>
<a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content', 'flatsome' ); ?></a>
<div id="wrapper">
<?php do_action( 'flatsome_before_header' ); ?>
<header id="header" class="header <?php flatsome_header_classes(); ?>">
<div class="header-wrapper">
<?php get_template_part( 'template-parts/header/header', 'wrapper' ); ?>
</div>
</header>
<?php do_action( 'flatsome_after_header' ); ?>
<main id="main" class="<?php flatsome_main_classes(); ?>">
Here is what I found in the 'template-parts/header/header, so when I input the link I want it to point to in the home url it takes me to a 404 error page
<!-- Header logo -->
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?><?php echo get_bloginfo( 'name' ) && get_bloginfo( 'description' ) ? ' - ' : ''; ?><?php bloginfo( 'description' ); ?>" rel="home">
<?php if(flatsome_option('site_logo')){
$logo_height = get_theme_mod('header_height',90);
$logo_width = get_theme_mod('logo_width', 200);
$site_title = esc_attr( get_bloginfo( 'name', 'display' ) );
if(get_theme_mod('site_logo_sticky')) echo '<img width="'.$logo_width.'" height="'.$logo_height.'" src="'.get_theme_mod('site_logo_sticky').'" class="header-logo-sticky" alt="'.$site_title.'"/>';
echo '<img width="'.$logo_width.'" height="'.$logo_height.'" src="'.flatsome_option('site_logo').'" class="header_logo header-logo" alt="'.$site_title.'"/>';
if(!get_theme_mod('site_logo_dark')) echo '<img width="'.$logo_width.'" height="'.$logo_height.'" src="'.flatsome_option('site_logo').'" class="header-logo-dark" alt="'.$site_title.'"/>';
if(get_theme_mod('site_logo_dark')) echo '<img width="'.$logo_width.'" height="'.$logo_height.'" src="'.get_theme_mod('site_logo_dark').'" class="header-logo-dark" alt="'.$site_title.'"/>';
} else {
bloginfo( 'name' );
}
?>
</a>
<?php
if(get_theme_mod('site_logo_slogan')){
echo '<p class="logo-tagline">'.get_bloginfo('description').'</p>';
}
?>
You can add below codes in your current active theme's functions.php file and don't forget to change "https://YourAnotherWebsite.com
" with the URL where you want to point.
function mrskt_custom_logo_url ( $mrskt_logo_html ) {
$mrskt_custom_logo_id = get_theme_mod( 'custom_logo' );
// Make sure to replace your updated site URL
$mrskt_new_url = 'https://YourAnotherWebsite.com';
$mrskt_logo_html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
esc_url( $mrskt_new_url ),
wp_get_attachment_image( $mrskt_custom_logo_id, 'full', false, array(
'class' => 'custom-logo',
) )
);
return $mrskt_logo_html;
}
// get_custom_logo: Returns a custom logo, linked to home unless the theme supports removing the link on the home page.
add_filter( 'get_custom_logo', 'mrskt_custom_logo_url' );
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
JavaScript is a multi-paradigm language that supports event-driven, functional, and mandatory (including object-oriented and prototype-based) programming types. Originally JavaScript was only used on the client side. JavaScript is now still used as a server-side programming language. To summarize, we can say that JavaScript is the language of the Internet.
https://www.javascript.com/
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.