<a href url problem click is adding local host
-
Hi Guys,
I have created a header-logo div, in the css I have the style, and also for the a, because when the image is declared as a background image it is not clickable, using the a allows the click:The problem is this line of code does open the browser, but with the localhost address before the URL, how do I fix this bit?
<a href=<?php echo stripslashes(get_option('header_text_url')) ?>/></a>
Returns this url:
http://localhost/wp/http//www.digitalraindrops.net/Thanks for your help!
David
As this forum is How-to’s and trouble shooting here is a How-to
I searched for hours trying to resolve a clickable background-image in the header, and could not find a good example answer, as I am new to php and WordPress I will share this method for others:
The Code, returns the url from the admin page options, check if the logo file exists then add the header-logo div:<?php { $logosrc = TEMPLATEPATH. '/images/logo.png'; if(get_option('header_logo_enabled')){ if (file_exists($logosrc)){ ?> <div id="header-logo"> <?php if(get_option('header_text_url')>""){ ?> <a href=<?php echo stripslashes(get_option('header_text_url')) ?>/></a> <?php } ?> </div> <?php } ?> <?php } ?> } ?style CSS:
#header-logo { float:left; height:85px; margin-top:20px; margin-left:20px; width:300px; overflow:hidden; background-image: url('images/logo.png'); background-repeat: no-repeat; background-position: center center; } #header-logo a { display: block; height:85px; width:300px; }
The topic ‘<a href url problem click is adding local host’ is closed to new replies.