WordPress.org

Ready to get started?Download WordPress

Forums

Link from header image to homepage (8 posts)

  1. owenjsutton
    Member
    Posted 1 year ago #

    my site is at http://maximusionsult.com

    I've spent several hours searching through the forums and after lots of experimenting can't seem to get this to work. I want a click on the header image to link back to the homepage. I know the change needs to be made in the header.php file... just can't seem to get the code right. Here is the current code.

    <div id="banner-bg" class="cf">
    	<div id="banner" class="row">
    		<div id="logo-area" class="col5">
    			<<?php bfa_if_front_else( 'h1', 'h3' ); ?> id="sitetitle">
                  <img style="float:left; margin-right:5px;" src="http://maximusionsult.com/logo-template-header.png" ><a href="<?php echo home_url"http://maximusionsult.com"; ?>"><?php bloginfo( 'name' ); ?></a>
    			</<?php bfa_if_front_else( 'h1', 'h3' ); ?>>
    			<p id="tagline"><?php bloginfo( 'description' ); ?></p>
    		</div>
    		<?php wp_nav_menu( array(
    			'container' => 'nav',
    			'container_class' => 'menu-wrapper col7',
    			'container_id' => 'menu1-wrapper',
    			'menu_id' => 'menu1',
    			'menu_class' => 'cf menu',
    			'theme_location' => 'menu1',
    			'fallback_cb' => 'bfa_page_menu'
    		) ); ?>
    	</div>
    </div>
    
    <a href="<?php bloginfo( 'rss2_url' ); ?>" class="rsslink" title="<?php _e( 'Subscribe to RSS Feed', 'montezuma' ); ?>"></a>
    
    <div id="breadcrumbs1-bg">
    	<nav id="breadcrumbs1" class="breadcrumbs lw">
    		<?php bfa_breadcrumbs( 'breadcrumbs1' ); ?>
    	</nav>
    </div>
  2. Andrew Bartel
    Member
    Posted 1 year ago #

    Wrap the <a> tag around the <img> tag. Anything within the <a></a> tags is what's linked. Ex: <a href="somepage.php">This will display as a link</a>. If you can't get it to work in a few tries I will provide a complete example with your file. Happy coding!

  3. owenjsutton
    Member
    Posted 1 year ago #

    Thanks so much for your help. I've made six attempts at it. Haven't broken anything, but still haven't gotten anywhere. Here is where my code currently stands

    <div id="banner-bg" class="cf">
    	<div id="banner" class="row">
    		<div id="logo-area" class="col5">
    			<<?php bfa_if_front_else( 'h1', 'h3' ); ?> id="sitetitle">
                  <img style="float:left; margin-right:5px;" <a src="http://maximusionsult.com/logo-template-header.png" > href="<?php bloginfo('url'); ?>"><?php bloginfo( 'name' ); ?></a>
    			</<?php bfa_if_front_else( 'h1', 'h3' ); ?>>
    			<p id="tagline"><?php bloginfo( 'description' ); ?></p>
    		</div>
    		<?php wp_nav_menu( array(
    			'container' => 'nav',
    			'container_class' => 'menu-wrapper col7',
    			'container_id' => 'menu1-wrapper',
    			'menu_id' => 'menu1',
    			'menu_class' => 'cf menu',
    			'theme_location' => 'menu1',
    			'fallback_cb' => 'bfa_page_menu'
    		) ); ?>
    	</div>
    </div>
  4. Andrew Bartel
    Member
    Posted 1 year ago #

    Owen, thanks for giving it a shot, really appreciate it. Please try this, should work, assuming we're targeting the right image. Please replace the entire logo-area div with this (five lines).

    <div id="logo-area" class="col5">
    			<<?php bfa_if_front_else( 'h1', 'h3' ); ?> id="sitetitle">
                  <a href="<?php echo home_url(); ?>"><img style="float:left; margin-right:5px;" src="http://maximusionsult.com/logo-template-header.png" ><?php bloginfo( 'name' ); ?></a>
    			</<?php bfa_if_front_else( 'h1', 'h3' ); ?>>
    			<p id="tagline"><?php bloginfo( 'description' ); ?></p>
    		</div>
  5. owenjsutton
    Member
    Posted 1 year ago #

    Mr. Bartel, I gotta give it a shot, trying to learn. I replaced the logo-area div with your code. I think I understand what you did, and it makes sense but... The image now does not load at all. (or it least isn't visible)

    I've left the site in this state if you'd like to take a look.

    http://maximusionsult.com

    Thanks again!

  6. Andrew Bartel
    Member
    Posted 1 year ago #

    My grandfather was Mr. Bartel :)

    Try this, sorry it's hard to get the syntax always right over the internet when i don't know what a theme will generate with its functions. We will get this working, even if I have to ftp into your server and make it right when I get into the office in the morning!

    <div id="logo-area" class="col5">
    	<a href="<?php home_url(); ?>"><img style="float:left; margin-right:5px;" href="http://maximusionsult.com/logo-template-header.png"></a>
    </div>
  7. owenjsutton
    Member
    Posted 1 year ago #

    I have to call it a night myself. Still no luck. That causes the same issue as before. I played with it quite a bit... I'm using a theme that allows me to edit php through the admin panel if that makes any difference to you. I've reverted back to the version I started the evening with for now. Thanks so much for your help.

  8. Andrew Bartel
    Member
    Posted 1 year ago #

    Hi Owen, could you email your contact details to andrew.bartel at gmail.com? I'll get in touch in the morning. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic