WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Logo in title Position of TwentyTen Theme - not linking to home (8 posts)

  1. jimii
    Member
    Posted 1 year ago #

    From other closed threads I've somewhat successfully uploaded logo's into the twentyten theme title position (top left of the masthead / header image) using child themes.

    In the first case method I modified the header php and the css code and it works fine. except - the logo hyperlinks to the home page (which is what i want), but the problem is that so too does the masthead / header image as well as the tag line in the top right of the page. Its as though everything above the menue bar is hyperlinked to the home page.

    In the second case method (on a temp url for site in dev) I just changed the header.php. It looks fine and generally works fine. The challenge is that nothing above the menu bar links to the home page. (the logo acts like it will link (ie the mouse switches from 'pointer' to 'clicker'), but it just refreshes the existing page.

    I can modify either of the above to the easiset method - but I simply want the logo to link to the home page - not the masthead/banner or the tagline. Any help would be greatly appreciated. (if links or code for either would help can post) Thank you.

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    please post a link to your site,
    and post the code(s) of your edited header section.

  3. jimii
    Member
    Posted 1 year ago #

    thank you for the reply alchymyth.

    This is the detail of the site with the edits made to php and the css - although the css changes were just the removal of the lines above and below the image area.

    Website Link:
    http://www.islandvacationrentals.com/

    The headerphp code was changed as follows:
    Changed from:

    <<?php echo $heading_tag; ?> id="site-title">
     <span>
     <a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
     </span>
     </<?php echo $heading_tag; ?>>

    Changed to:

    <h1 id="site-title">
     <span>
     <a href="<?php bloginfo ('home');?>" rel="home" title="<?php bloginfo('name');?>">
     <img src="<?php echo bloginfo ('template_directory');?>/images/logo.png" alt="<?php bloginfo ('name');?>" />
     </a>
     </span>
     </h1><!--end of h1 site-title-->

    The css code was changed/edited as follows just to remove the lines:

    }
    #branding img {
    	border-top: none;
    	border-bottom: none;
    	display: block;
    	float: left;
    }

    (just editing the border-top and border-bottom from
    px to none.

    Jimii

  4. jimii
    Member
    Posted 1 year ago #

    The link sorry is at: IslandVacationRentals.com

  5. jimii
    Member
    Posted 1 year ago #

    The code for the other site - edited with pho header modifications - that does not hyperlink to the home page (but would like it to), was changed from this original code:

    <div id="header">
    		<div id="masthead">
    			<div id="branding" role="banner">
    				<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
    				<<?php echo $heading_tag; ?> id="site-title">
    					<span>
    						<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
    					</span>
    				</<?php echo $heading_tag; ?>>
    				<div id="site-description"><?php bloginfo( 'description' ); ?></div>
    
    				<?php

    to this modified code: (i substituted into this code example an artificial url as the site is in redevelopment on a temp url - actual is available but prefer not to public post it).

    <div id="header">
    			<div id="masthead">
    <div id="branding" role="banner">
    				<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
    				<<?php echo $heading_tag; ?> id="site-title">
    					<span>
    <div id="logo"> <a href="<?php bloginfo('template directory'); ?>"><img src="http://ARTIFICIAL-TEMPORARY-URL.COM/wp-content/themes/mytwentyten/images/Site-Name-logo-75h.jpg" alt="SITE NAME"/></a></div>
    </span>
    			</<?php echo $heading_tag; ?>>
    				<div id="site-description"><?php bloginfo( 'description' ); ?></div>
    	<?php

    Any guidance on this is appreciated. thank you Jimii

  6. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    bloginfo('template directory') would link to your current WordPress theme's folder (parent theme if you use a child theme);

    http://codex.wordpress.org/Function_Reference/bloginfo

    better use:
    http://codex.wordpress.org/Function_Reference/home_url

    try to replace this line:

    <div id="logo"> <a href="<?php bloginfo('template directory'); ?>"><img src="http://ARTIFICIAL-TEMPORARY-URL.COM/wp-content/themes/mytwentyten/images/Site-Name-logo-75h.jpg" alt="SITE NAME"/></a></div>

    for example with:

    <div id="logo"> <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="http://ARTIFICIAL-TEMPORARY-URL.COM/wp-content/themes/mytwentyten/images/Site-Name-logo-75h.jpg" alt="SITE NAME"/></a></div>
  7. jimii
    Member
    Posted 1 year ago #

    alchymyth, thank you very much for this, I appreciate the guidance to the ref. articles and I've implemented your suggested corrections for both sites and it works just great. : )

  8. jimii
    Member
    Posted 1 year ago #

    just marking as resolved

Topic Closed

This topic has been closed to new replies.

About this Topic