• I want to make my header image that is clickable in Twenty Eleven go not to my home (www.ipscell.com) but to a different link entirely.

    How do I make this change?

    Thanks
    Paul

Viewing 10 replies - 16 through 25 (of 25 total)
  • It’s possible but how should the code handle Posts, categories and other archive pages?

    I don’t know ??

    Should the header link simply point to the Home page?

    The header link should point to the parent page.

    Try replacing:

    <a href="<?php echo esc_url( home_url( '/' ) ); ?>">

    with:

    <?php if( is_page() ) : // Are we on a static Page
    if( !$post->post_parent ) : // is this is a top level page?
    $my_link = get_permalink($post->ID); // grab the page's id
    elseif( $this_page->ancestors ) :
    // we're on a sub-page, so get the top ID of this page tree. Page ids DESC so top level ID is the last one
    $ancestor = end($this_page->ancestors);
    my_link = get_permalink($ancestor); // grab the page's id
    endif;
    else : // we're not on a static Page
    $my_link = esc_url( home_url( '/' ) );
    endif;?>
    <a href="<?php echo my_link; ?>">

    Since posts don’t have a parent Page, they’ll use the home page url in this example. Please bear in mind that I haven’t tested this, so I apologies in advance for any syntax errors.

    Esmi

    Your code above is pretty awesome, but I was wondering if you can help me with this issue. Here is the link to the development version of a site I am working on:

    https://compassrose.raidiouscontrol.com

    I have created a child version of the twentyeleven theme and edited it heavily. I have changed the default image size for the rotating header image successfully and it rotates on every page of the site. I just received a request from the client that each of the three header images but converted to links. While this isn’t difficult to do with the code listed above, the client asked that each image link to a different internal site URL.

    Do you have any suggestions on how I can achieve this?

    Thanks in advance for your help!

    Could you please post your own topic.

    Thanks esmi, but I got syntax error..

    Parse error: syntax error, unexpected ‘=’ in G:\home\zilloman.com\html\wp-content\themes\wbd\header.php on line 104

    I have no idea what line 104 is.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Twenty Eleven Header Clickable Image Link Customization Help Needed’ is closed to new replies.