Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread Display Modes
Old Mar 21, 2013, 05:09 PM   #1
macrumors 68040
Kingsly's Avatar
Join Date: Aug 2005
Location: Either in front of a computer or behind a camera.
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:

<?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
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
macrumors 68000
SrWebDeveloper's Avatar
Join Date: Dec 2007
Location: Alexandria, VA, USA
A cheap fix (noting the advice of jsm4182 is for far better long term solutions):

As your site uses jQuery:

$("header#branding").click(function () {
Or if you prefer traditional JS:


function goHome() {
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
SrWebDeveloper is offline   0 Reply With Quote

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
[php] - php problems os x mountain lion 10.8.2 cakas6933 OS X 10.8 Mountain Lion 4 Jun 10, 2014 08:08 AM
Apple Applies for Patent on 'Audio Hyperlinking' to Facilitate Accessing Supplementary Podcast Content MacRumors MacRumors.com News Discussion 49 Aug 9, 2013 01:03 AM
PHP editor macmesser Web Design and Development 17 Jun 30, 2013 09:48 AM
HyperLinking Buttons in Xcode? DarthVader1213 Mac Programming 1 Aug 15, 2012 09:21 AM

Forum Jump

All times are GMT -5. The time now is 11:33 AM.

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

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