Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Clickable header in rtPanel child theme

Dinesh Jain edited this page Jan 17, 2016 · 1 revision

We do come across some Wordpress sites that don't have logos but have the header image banners instead. And some popular themes like Twenty Eleven provides an option only for the header image, while there is no separate option for uploading the logo from the back-end. In such cases, like in Twenty Eleven themes, the header image and logo are the same and hence are clickable by default.

But what if users want the different options for both header and logo? Considering that we have provided options for the header image and logo separately in rtPanel Theme Framwork. That is, if we upload the logo, its clickable, but if we upload the header image, its not clickable.

Creating the Header Image Banner:

If we need the header image banner instead of the logo, just put the following code into your child theme's header.php file, under the

section.
$header_image = get_header_image();

This $header_image variable now outputs the Header Image URL when echoed. So, echo this image using tag within the tag, linking to the homepage.

echo '<a href="'.esc_url( home_url( '/' ) ).'"><img src="'.$header_image.'" alt=""/></a>';

Once done successfully, the header image now appears clickable, redirecting to the homepage on clicking.

Clone this wiki locally