Jump to content
Sign in to follow this  
liverpoolfootballblog

How to place large google banner ad within the header, next to my logo.

Recommended Posts

liverpoolfootballblog
Screen-shot-2011-04-30-at-1.59.47-PM.png I want to place a google leaderboard ad, you know, the one long horizontal one, right next to my logo. The problem is, I don't know how to do that. Any tips folks?

Share this post


Link to post
Share on other sites
ricardo

Hi Andrew! Theoretically you can use a hook but that would mean that the ad code would have to be inside functions.php which might not be practical... Ricardo

Share this post


Link to post
Share on other sites
hyest

Hello, I believe your best bet would be to open up header.php (in your template directory) In there you will find this code:

<div class="headline">
								<?php if(pagelines('custom_header')):?>
									/" title="<?php bloginfo('name');?>">" alt="<?php bloginfo('name');?>" />
								<?php else:?>
								<h1 class="site-title">/" title="<?php _e('Home',TDOMAIN);?>"><?php bloginfo('name');?></h1>
								<h6 class="site-description"><?php bloginfo('description');?></h6>
								<?php endif;?>
							</div>[/code]

	
	Try adding the banner just after the closing h6, in the end it might look something like this:
	
	
[code] <h6 class="site-description"><?php bloginfo('description');?></h6> <div style="float:right;"> logo.jpg</div>

Keep in mind, the image will float all the way to the right, so you may have to add some additional styling for right padding etc, depending on the size of your image. Hopefully that helps! Chris

Share this post


Link to post
Share on other sites
hyest

hmm, somehow the code got interpreted even though i used the code tag, but basically, after the closing h6 tag, add a div (probably use float right as above) then put your link and image in there

Share this post


Link to post
Share on other sites
catrina

The best solution is to use a hook in the header area rather than editing the parent file directly (refer to this tutorial on implementing one: http://www.pagelines.com/docs/base-child-theme), but then like Ricardo said, the ad code might not play nicely in the functions file. What ad code are you using? Is it from the Google advertising page?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
liverpoolfootballblog

Thanks for all your answers guys. Ok. So I tried using a custom hook like you said and followed that tutorial. When I inserted the google ad code after and updated functions.php I got a syntax error on line 109. Here's what I did:

// add_action('hook_name','function name');
	
		// ---> uncomment to load
		//add_action('pagelines_before_branding', 'google_leaderboard_ad');
	
		// function name
		function google_leaderboard_ad(){?>
	
		<script type="text/javascript"><!--
		google_ad_client = "ca-pub-7490177638192212";
		/* Leaderboard big */
		google_ad_slot = "9626487354";
		google_ad_width = 728;
		google_ad_height = 90;
		//-->
		</script>
		<script type="text/javascript"
		src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	
		<?php }
		// end function

Can you spot any errors?

Share this post


Link to post
Share on other sites
ricardo

Apparently you just have to uncomment the add_action (remove the double forward slash... apart from that it looks ok. I'm wondering if this wouldn't go better in the footer scripts...

Share this post


Link to post
Share on other sites
liverpoolfootballblog

Genius! Yeah that worked. It's now displaying. The Syntax error was just '-' instead of '_' and the system freaked. Screen-shot-2011-05-01-at-3.18.36-AM.png It's not displaying nicely. Do you know how I can add a # to it so I can style it with CSS?

Share this post


Link to post
Share on other sites
Simon

If you contain it inside a div, and give that div an ID you will be able to change its position using some simple css from the platform settings.

Share this post


Link to post
Share on other sites
liverpoolfootballblog

I'm sorry but I'm not very good at this. What code would I need to add in order to do that to this:

// add_action('hook_name','function name');
	
		// ---> uncomment to load
		add_action('pagelines_inside_bottom_branding', 'google_leaderboard_ad');
	
		// function name
		function google_leaderboard_ad(){?>
	
		<script type="text/javascript"><!--
		google_ad_client = "ca-pub-7490177638192212";
		/* Leaderboard big */
		google_ad_slot = "9626487354";
		google_ad_width = 728;
		google_ad_height = 90;
		//-->
		</script>
		<script type="text/javascript"
		src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	
		<?php }
		// end function

Share this post


Link to post
Share on other sites
catrina
If you contain it inside a div, and give that div an ID you will be able to change its position using some simple css from the platform settings.
What Simon means is that if you put the Google code inside of a DIV (which is basically a box container), you can use CSS styling to position it where you want. Here's the code for the DIV along with your Google code (I'm giving the DIV name "leaderboard" so that you can identify it easily):
<div class="leaderboard">
	<script type="text/javascript"><!--
	google_ad_client = "ca-pub-7490177638192212";
	/* Leaderboard big */
	google_ad_slot = "9626487354";
	google_ad_width = 728;
	google_ad_height = 90;
	//-->
	</script>
	<script type="text/javascript"
	src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
	</script>
	</div>
Notice the
<div class="leaderboard"></div>
tags at the beginning and end of the code. Copy and paste this entire code in place of what you already have in the hook. Now copy and paste this CSS into the custom CSS area (Settings > Custom Code > CSS Rules):
div.leaderboard {float: right;}

The styling inside this can be changed according to how you want the leaderboard to be positioned. Save the settings, refresh the page, and let me know how it works out for you.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
liverpoolfootballblog

When I copied that code in I got:

Parse error: syntax error, unexpected '<' in /home/liverpoo/public_html/wp-content/themes/platformbase/functions.php on line 103
// add_action('hook_name','function name');
	
		// ---> uncomment to load
		add_action('pagelines_inside_bottom_branding', 'google_leaderboard_ad');
	
		// function name
		function google_leaderboard_ad(){?>
	
		<div class="leaderboard">
		<script type="text/javascript"><!--
		google_ad_client = "ca-pub-7490177638192212";
		/* Leaderboard big */
		google_ad_slot = "9626487354";
		google_ad_width = 728;
		google_ad_height = 90;
		//-->
		</script>
		<script type="text/javascript"
		src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
		</div>
	
		<?php }
		// end function
	

Did I enter something wrong?

Share this post


Link to post
Share on other sites
catrina

Ah, sorry, here's the correct code (I did not pay attention to the last part of the code where there's a separate script):

<div class="leaderboard">
	<script type="text/javascript"><!--
	google_ad_client = "ca-pub-7490177638192212";
	/* Leaderboard big */
	google_ad_slot = "9626487354";
	google_ad_width = 728;
	google_ad_height = 90;
	//-->
	</script>
	</div>
	<script type="text/javascript"
	src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
	</script>

Replace the code you have with the one above.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
liverpoolfootballblog

Thank you so much for your help everyone and especially you Catrina. Finally did it. Screen-shot-2011-05-01-at-4.39.21-AM.png Just needed to change re-upload the code through FTP and the syntax error went away. Changed it to pagelines_inside_top_banner and tweaked the CSS to my liking. Thanks again.

Share this post


Link to post
Share on other sites
hyest

Do the hooks and the hook names only apply to pagelines pro? I have station pro and eco pro, and just curious of they both support the hooks and hook names. Thanks

Share this post


Link to post
Share on other sites
liverpoolfootballblog

Guys, it looks nice now but the problem is that you can't click on the ad. When you hover over it there's no way to click. I used a hook to move the search box too, following the video example by Adam, but now that is not clickable either. Here, take a look and tell me what you think. http://liverpoolfootballblog.com/

Share this post


Link to post
Share on other sites
catrina

Andrew, I can't see the Google banner ad in the header (I'm using Firefox for Mac)...


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hyest

I see the Ad and its clickable .. using firefox 4.01 for windows. Also Andrew, you may want to check out the buddy press sliding login.. it looks way cooler than the standard admin bar you see at the top. Just make sure to read the full instructions as there are a few steps to make it work. http://wordpress.org/extend/plugins/buddypress-sliding-login-panel/ you can check it out here (top right) if you want to see a working example: http://www.marijuananm.com/

Share this post


Link to post
Share on other sites
hyest

Also, you may want to make that ad link open in a new window so people don't leave your site. Add target="_blank" to your link. If nothing else, you got a few clicks :)

Share this post


Link to post
Share on other sites
liverpoolfootballblog

Hey guys I just switched the hooks around and for some reason that made it clickable. Thanks for testing it out for me though ;) Chris, thanks for the tip. I might just give it a try. It looks pretty cool on your site :) .

Share this post


Link to post
Share on other sites
jwheeler81
hi there- I'm trying to use this same code to add a leaderboard to the top of my site. The only difference is that I'm using code from DFP Small Business so I'm tweaking it slightly to match the DFP code. This is what the DFP ad unit code looks like for my leaderboard placement: Using the thread and code above, here is what i tried within functions.php: // add_action('hook_name','function name'); // ---> uncomment to load add_action('pagelines_inside_bottom_branding', 'leaderboard_ad'); // function name function leaderboard_ad(){?> <div class="leaderboard"> <script type="text/javascript"> GA_googleFillSlot("728x90_top_tps"); </script> <?php } // end function it's telling me i have a syntax error on line 110. does anyone have any thoughts on what i may have done wrong? thanks so much!

Share this post


Link to post
Share on other sites
jwheeler81
so i ended up using this and it worked. i just need to get it to float right and i'm all set:) : // add_action('hook_name','function name'); // ---> uncomment to load add_action('pagelines_inside_bottom_branding', 'leaderboard_ad'); // function name function leaderboard_ad(){ // This hook adds a stumbleupon icon to the header of your theme. The class referenced in the link can be seen in the style.css // and is the image from the CSS is placed in the images folder ?>

Share this post


Link to post
Share on other sites
catrina
You'll need to add the script inside a DIV so that it looks like this: [code]
[/code] Then add this code to Custom Code > Custom CSS OR the PlatformBase stylesheet in Appearance > Editor: [code]div.leaderboard {float: right;}[/code]

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×