WordPress.org

Forums

Codium Extend
Make Header Clickable (10 posts)

  1. novacode7
    Member
    Posted 2 years ago #

    Codium Extend is a great, minimalist theme, but I haven't been able to find a way to make the header image clickable. The header is loaded as a background image via CSS in functions.php:

    function header_style() {
        if (get_header_image() != ''){
        ?><style type="text/css">
            div#header {
                background: url(<?php header_image(); ?>); height :230px; -moz-border-radius-topleft:6px;border-top-left-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;
            }

    Here's my website. Any ideas?

    http://wordpress.org/extend/themes/codium-extend/

  2. WPyogi
    Forum Moderator
    Posted 2 years ago #

    Background images are not clickable -- though there evidently are a few tricky workarounds -- see this.

    Or you could put the image in the header (as an image, not a background image) and then it can be clickable in the usual way. The page appearance should be the same as it is now. To do this you'd need to modify the header.php file, adding the link and image tags just above the existing h1 blog title code.

    Make sure you are using a Child Theme if you are making changes to core files...

  3. novacode7
    Member
    Posted 2 years ago #

    Thanks WPyogi. I was pretty sure there wasn't an easy work around for this.

    It is an easy switch to load it as an image via the header.php file, but I was hoping to not have to modify my theme this way. I assume that by loading the header image in this way I will no longer be able to use WP's "Appearance" - "Header" function to change the header easily in the future.

  4. mattborghi
    Member
    Posted 2 years ago #

    I looked quite a bit, but did find a super-easy fix in the codex:

    If you change your header div from this
    <div id="header">

    to this, you get a clickable header:
    <div id="header" onclick="location.href='http://yoururl.com/';" style="cursor: pointer;">

    Glad I found a fix for this... would be nice to see this as an option, in the Appearance nav...

    matt

  5. swekarl
    Member
    Posted 2 years ago #

    Excellent Matt, I had the same problem and this was a beautiful solution - I could finally remove the "Home" item in my menu.

    If you have any idea how to scale down the header image for mobile devices (it gets cut, looks ugly) or how to make it that mobile devices get the text header instead, please enlighten us. (I've asked in another thread, but you seem to know your things.)

  6. jammin184
    Member
    Posted 2 years ago #

    Yes! Been having that problem for awhile now. Thanks for the clickable header fix.

    Agree with Swekari, the header not showing on mobile is an issue. I've been messing with the css for awhile now trying to figure out how to get it to scale down or perhaps shift the entire image to the left to see the header image. No luck so far...

  7. yaselpolo
    Member
    Posted 2 years ago #

    Thanks mattborghi, I just tried your info and It Worked perfect in my blog....

    Thanks!

  8. the better workaround would be to make the header image the background of the anchor tag and resize it to the correct size if need be. (On my site, wpcamper.com, I wanted a smaller image instead of a full wide header, so I added the following CSS:

    #blog-title a {
    	display:block;
    	background:url('http://wpcamper.com/files/2012/08/wpcamper2.png') top left;
    	background-size:100%;
    	background-repeat:no-repeat;
    	height:100px;
    	width:400px;
    	max-width:100%;
    	font-size:0;
    }

    Note, for this to work, you actually want to leave the header text turned on. The css makes it invisible by changing the font size to 0.

  9. swekarl
    Member
    Posted 2 years ago #

    There's finally a solution to the problem of header image being cut in mobile interface. Just update to the latest version of Jetpack that was released a couple of days ago, and activate the new mobile feature. It's excellent! I'm so happy my sites finally look good on all platforms.

    Thanks for your help too, Andrew, though it didn't work (well) for me. ;)

  10. purpledani9
    Member
    Posted 2 years ago #

    I'm trying to expand my header to fit the body/content size that I've edited. Unfortunately the header image doesn't cover the area well...the picture repeats. I'm not sure how to fix that.

    Also the navigation menu bar isn't going all the way across. I'm not sure how to widen this to fit. Any help would be appreciated!

    my url is http://www.mysnippetsofinspiration.com

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic