# Php coding help on wordpress site



## freaksavior (Sep 10, 2010)

So I need to make a header a hotlink to an email address.

http://bestbetroofing.com/get-a-free-roof-inspection

The header "Get a free roof inspection" Needs to open in a link to freeinspection@bestbetroofing.com

Can anybody help me out? I can give you any login via pm if you need it. 

Thank you.


----------



## Easy Rhino (Sep 10, 2010)

freaksavior said:


> So I need to make a header a hotlink to an email address.
> 
> http://bestbetroofing.com/get-a-free-roof-inspection
> 
> ...



so you want that pic in the header to link to an email address? i think this is more of a wordpress question than a php question. checkup on how wordpress links to email accounts.


----------



## W1zzard (Sep 10, 2010)

google: html mailto


----------



## Solaris17 (Sep 10, 2010)

you need to include mailto.

mailto:freeinspection@bestbetroofing.com

this will auto open any email client on the host PC.


----------



## Easy Rhino (Sep 10, 2010)

i think he knows how to code it, he just doesnt know what part of the php code in wordpress he has to edit.


----------



## freaksavior (Sep 10, 2010)

W1zzard said:


> google: html mailto





Solaris17 said:


> you need to include mailto.
> 
> mailto:freeinspection@bestbetroofing.com
> 
> this will auto open any email client on the host PC.



I know  

The file I need to edit is called "single.php" I currently have


```
<?php

if (is_page(array('get-a-free-roof-inspection'))) { ;?>
<div class="post-7 page type-page hentry"></div>
 <?php get_footer(); ?>
<?php } else { ?>


 <?php } ?>
 
 
 <?php
 
get_header();

$portfolio_post = get_post_meta($post->ID, 'portfolio_full_img', true);
$portfolio_layout = get_post_meta($post->ID, 'portfolio_post_layout', true);

if($portfolio_post && !$portfolio_layout){
	require(WEBTREATS_INCLUDES . "/template-portfolio-single.php");
}else{
	require(WEBTREATS_INCLUDES . "/template-single.php");
}

?>
```
But I do not know how to add the call sign to open the link.


----------



## GSG-9 (Sep 10, 2010)

YourFTP>>WP-Content>>themes>>your theme>>header.php

In mine I have this line:

```
<h2><a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></h2>
```
Change it to:

```
<h2><a href="mailto:freeinspection@bestbetroofing.com"><?php bloginfo('name'); ?></a></h2>
```

See if that works, It will not make the entire header a hyperlink, just your site text, but it is probably a better way to go about it anyway.

Edit: I jsut saw you removed your title completely so the above method will not work.


----------



## freaksavior (Sep 10, 2010)

I have 


```
<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
```

This is the entire header file. 



Spoiler



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>

<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/lib/scripts/prettyPhoto/css/prettyPhoto.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

<?php require(WEBTREATS_INCLUDES . "/var.php"); ?>

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_directory'); ?>/styles/<?php echo $color_scheme; ?>" />

<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>	

<meta name="disable_cufon" content="<?php echo $cufon_disable; ?>" />
<meta name="slider_speed" content="<?php echo $slider_speed; ?>" />
<meta name="slider_disable" content="<?php echo $slider_disable; ?>" />

<?php
$css_style_path = str_replace('.css', '', $color_scheme);
if($css_style_path == 'black') {
	$css_style_path = '/images';
}else{
	$css_style_path = '/styles/' .$css_style_path;
}
$template_dir = get_template_directory_uri();
if(is_home()) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery.preloadImages("<?php echo $template_dir.$css_style_path; ?>/home_feature.jpg","<?php echo $template_dir.$css_style_path; ?>/stage.jpg","<?php echo $template_dir.$css_style_path; ?>/header.jpg","<?php echo $template_dir; ?>/images/slider_inactive.png","<?php echo $template_dir; ?>/images/buttons.gif","<?php echo $template_dir.$css_style_path; ?>/buttons.gif","<?php echo $template_dir; ?>/images/slider_active.png","<?php echo $template_dir.$css_style_path; ?>/drop.png","<?php echo $template_dir.$css_style_path; ?>/dropR.png","<?php echo $template_dir.$css_style_path; ?>/drop_sub.png");
/* ]]> */
</script>
<?php } ?>

<!--[if IE 6]>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/styles/ie6/ie6.css" type="text/css" media="screen" />
<script src="<?php echo WEBTREATS_JS; ?>/DD_belatedPNG_0.0.8a-min.js"></script>
<script>
    DD_belatedPNG.fix('#default_logo, .slider_frame');
</script>
<![endif]-->

</head>

<body<?php if(is_home()){echo' id="home_page"';} ?><?php if($teaser_style){echo' class="inset"';} ?>>
<div id="header">
	<div class="inner">
		<?php if($site_name) {
			 	$blog_title = get_bloginfo('name'); 
				$blog_title = ($blog_title) ? $blog_title : 'inFocus'; ?>
			<div id="site_name">
				<a href="<?php echo get_option('home'); ?>"><?php echo $blog_title; ?></a>
			</div>
		<?php }else{ ?>
			<div id="logo">
				<?php if(!$custom_logo) { ?>
					<div id="default_logo"><a href="<?php echo get_option('home'); ?>"></a></div><?php
				 }else{ ?>
					<a href="<?php echo get_option('home'); ?>"><img src="<?php echo $custom_logo; ?>" /></a><?php 
				 } ?>
			</div>
		<?php }

//Exclude a parent and all of that parent's child Pages
if($show_hide_pg) {
	$parent_pages_to_exclude = explode(",", $show_hide_pg);
	foreach($parent_pages_to_exclude as $parent_page_to_exclude) {
		if ($page_exclusions) { $page_exclusions .= ',' . $parent_page_to_exclude;
		}else{
			$page_exclusions = $parent_page_to_exclude; }
		$descendants = get_pages('child_of=' . $parent_page_to_exclude);
		if($descendants){
			foreach($descendants as $descendant) {
				$page_exclusions .= ',' . $descendant->ID;
			}
		}
	}	
}
?>
		<div id="main_navigation" class="jqueryslidemenu">
			<ul>
				<li <?php if (is_front_page()){echo 'class="current_page_item"';} ?> ><a href="<?php echo get_settings('home'); ?>">Home</a></li>
				<?php wp_list_pages("sort_column=menu_order&exclude=$page_exclusions&title_li="); ?>
			</ul>

		</div><!-- main_navigation -->				
	</div><!-- inner -->
</div><!-- header -->


----------



## Solaris17 (Sep 10, 2010)

just add


```
<h2><a href="mailto:freeinspection@bestbetroofing.com">
```

before blog info

remember to close header and <a>


----------



## GSG-9 (Sep 10, 2010)

You have:

```
<body<?php if(is_home()){echo' id="home_page"';} ?><?php if($teaser_style){echo' class="inset"';} ?>>
<div id="header">
<div class="inner">
<?php if($site_name) {
$blog_title = get_bloginfo('name');
$blog_title = ($blog_title) ? $blog_title : 'inFocus'; ?>
<div id="site_name">
<a href="<?php echo get_option('home'); ?>"><?php echo $blog_title; ?></a>
</div>
<?php }else{ ?>
<div id="logo">
<?php if(!$custom_logo) { ?>
<div id="default_logo"><a href="<?php echo get_option('home'); ?>"></a></div><?php
}else{ ?>
<a href="<?php echo get_option('home'); ?>"><img src="<?php echo $custom_logo; ?>" /></a><?php
} ?>
</div>
<?php }
```
Try:

```
<body<?php if(is_home()){echo' id="home_page"';} ?><?php if($teaser_style){echo' class="inset"';} ?>>
<div id="header">
<div class="inner">
<?php if($site_name) {
$blog_title = get_bloginfo('name');
$blog_title = ($blog_title) ? $blog_title : 'inFocus'; ?>
<div id="site_name">
<a href="<?php echo get_option('home'); ?>"><?php echo $blog_title; ?></a>
</div>
<?php }else{ ?>
<div id="logo">
<?php if(!$custom_logo) { ?>
<div id="default_logo">[COLOR="DarkRed"]<a href="mailto:freeinspection@bestbetroofing.com">[/COLOR]</a></div><?php
}else{ ?>
[COLOR="DarkRed"]<a href="mailto:freeinspection@bestbetroofing.com">[/COLOR]<img src="<?php echo $custom_logo; ?>" /></a><?php
} ?>
</div>
<?php }
```

Edit: I only changed the default logo, it is fixed now.


----------



## freaksavior (Sep 10, 2010)

@ Solaris17
@ GSG-9

Neither worked.

edit: still didn't work after you did your edit.


----------



## Solaris17 (Sep 10, 2010)

freaksavior said:


> @ Solaris17
> @ GSG-9
> 
> Neither worked.
> ...



ugh. for you I will look at the code.


----------



## Easy Rhino (Sep 10, 2010)

freaksavior said:


> @ Solaris17
> @ GSG-9
> 
> Neither worked.
> ...



nvm.


----------



## GSG-9 (Sep 10, 2010)

What did it do? If the link still worked your theme is not using the header (or the logo part we changed) file. If it was broken thats good because then we just need to tweak it.


----------



## Solaris17 (Sep 10, 2010)

GSG-9 said:


> What did it do? If the link still worked your theme is not using the header (or the logo part we changed) file. If it was broken thats good because then we just need to tweak it.



ya we need more info did it just not show up? or was it not linked?

i dont really see anything wrong with what he typed up.


----------



## freaksavior (Sep 10, 2010)

I already removed it, but when I add "<h2><a href="mailto:freeinspection@bestbetroofing.com"></a></h2>"

It makes everything bigger :/

When I had the large amount of code, nothing changes.


----------



## Solaris17 (Sep 10, 2010)

freaksavior said:


> I already removed it, but when I add "<h2><a href="mailto:freeinspection@bestbetroofing.com"></a></h2>"
> 
> It makes everything bigger :/
> 
> When I had the large amount of code, nothing changes.



thats just because of the heading. just remove the <h2>


----------



## Easy Rhino (Sep 10, 2010)

http://en.forums.wordpress.com/topic/how-can-i-create-an-email-link


----------



## GSG-9 (Sep 10, 2010)

I was telling you how to change your actual header logo into an email link. Thats not what you wanted, I misread 

Solaris's solution is exactly what you want. 

<a href="mailto:freeinspection@bestbetroofing.com"></a>


----------



## freaksavior (Sep 10, 2010)

GSG-9 said:


> You took the section I posted from your header.php  above and put it back into the full header.php (removing the old/pre changed section) correct?
> 
> So your full header.php file is:
> 
> ...



I added that code and now the header is whacked  

Easy Rhino, i'll take a look at that, but im not sure that is right.

Also just to make sure y'all understand what I want.

When you go to that page there is a brown box with the words Get a free roof inspection, i want that to open up to mailto:


----------



## Easy Rhino (Sep 10, 2010)

freaksavior said:


> I added that code and now the header is whacked
> 
> Easy Rhino, i'll take a look at that, but im not sure that is right.
> 
> ...



find that image. add the proper mailto code to it. done.


----------



## GSG-9 (Sep 10, 2010)

(The image is in <div id="intro_blurb_title"> so find the php file containing that div tag)


----------



## Solaris17 (Sep 10, 2010)

GSG-9 said:


> (The image is in <div id="intro_blurb_title"> so find the php file containing that div tag)



this. you cant add it to that with the page you are giving us. you need to add the mailto prefix to the page containing the code for that title.

i need to go to work but GSG has you covered.

after you find the page it will go something like

<a href="mailto:freeinspection@bestbetroofing.com"><some BS thats already their "get a free roof inspection"></a>


----------



## freaksavior (Sep 10, 2010)

The header file has to do with the very very top of the site, I think we are editing the wrong file.


----------



## Easy Rhino (Sep 11, 2010)

freaksavior said:


> The header file has to do with the very very top of the site, I think we are editing the wrong file.



you called the banner the header. it is not the header obviously. which is why they are confused. all you have to do is find the link to that image, and add the mailto tag!!!!!!!1

edit: you need to be more clear. do you want the "get a free roof inspection" text in the header to be changed to a mail link?

or do you want the graphic banner below the header and between the text to be a mail link?


----------



## freaksavior (Sep 11, 2010)

I apologize, you are right, I did say that.

What I want is this to be a hotlink


----------



## GSG-9 (Sep 12, 2010)

Solaris17 said:


> this. you cant add it to that with the page you are giving us. you need to add the mailto prefix to the page containing the code for that title.
> 
> i need to go to work but GSG has you covered.
> 
> ...



lol, I left at almost the same time you posted this for a Rugby tournament, I will not be back by my computer till sunday night.

freak you should just have to find <div id="intro_blurb_title"> (so open your php files and search for it until you find it) and when you find it put the code in that solaris made.


----------



## freaksavior (Sep 13, 2010)

Im on a new issue, i'll figure out the other one later.

He wants the bbb logo added to the right on the header. So I added the code to the header file but it shoves everything else lower. Is this the css sheet or the php file that is causing this?

Ideally I want to have the best bet logo on the left, and the bbb logo on the right, and the nav menu in the middle


----------

