Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 21, 2013, 05:09 PM   #1
Kingsly
macrumors 68040
 
Kingsly's Avatar
 
Join Date: Aug 2005
Location: Nature
Hyperlinking within php?

Personally, I've given up on wordpress - I can bs my way through a pretty nice looking website with html and css in DW, but all this php business has my head spinning...

My wife's site has a header banner and for whatever reason this particular theme does not allow for the provision to make that header banner image a clickable "back to home" link. I've given it my all, and only managed to break the site over and over. Thank goodness for backups!

This is where I [think] i've narrowed the code relating to the image to be, in the header.php file:

Code:
<?php do_action( 'instamate_before_header' ); ?>
	<?php $header_image = get_header_image();?>
	<header id="branding" class="clearfix" role="banner"<?php if ( ! empty( $header_image ) ) { ?> style="background: url(http://www.starobryan.com/wp-content/uploads/2012/12/logo2.jpg) no-repeat top center;max-width: <?php echo get_custom_header()->width; ?>px; min-height: <?php echo get_custom_header()->height; ?>px;"<?php } ?>>
Kingsly is offline   0 Reply With Quote
Old Mar 21, 2013, 10:35 PM   #2
jsm4182
macrumors 6502
 
Join Date: Apr 2006
Location: Newburgh, NY
Send a message via AIM to jsm4182
The way that header is being handled it makes it almost impossible to link it. The header image is a css background image. The site title is a clickable link as a should be in a Wordpress site, but is hidden with css.

I see a few ways it could be done.
  • Instead of having the image as a background of the header area, put the site title back in and put the image as a background on that.
  • Put the site title back in, position it over the image and use a negative indent to hide the text.
  • In the template put the image directly in the link replacing the text.
__________________
Mac Mini, 2.3ghz i7, 16GB RAM, 1TB HDD, ML | MacBook Air 13", 1.3ghz i5, 1GB RAM, 128GB SSD, ML | iPhone 5 32GB White | iPad 3 64GB Black
jsm4182 is offline   0 Reply With Quote
Old Mar 22, 2013, 04:20 AM   #3
SrWebDeveloper
macrumors 68000
 
SrWebDeveloper's Avatar
 
Join Date: Dec 2007
Location: Alexandria, VA, USA
 
see vendor information in user profile
A cheap fix (noting the advice of jsm4182 is for far better long term solutions):

As your site uses jQuery:

Code:
$("header#branding").click(function () {
  $(window).attr("location","/");
});
Or if you prefer traditional JS:

Code:
document.getElementsByTagName('header').addEventListener('click',goHome,false);

function goHome() {
    window.location.href="/";
}
Basically I'm adding an event listener for an onClick for your header tag and redirects to "/" which is your home page (docroot, relative path). This is a cheap fix as there is an obvious dependency on JS/jQuery.

Add either into the theme's script.js where appropriate.
__________________
Jim Goldbloom
Sr. Web Developer, owner GoldTechPro, LLC
http://www.GoldTechPro.com
SrWebDeveloper is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:25 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC