Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
aligning adsense in wordpress header?
Old 12-20-2007, 02:26 PM aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
I'm trying to put my adsense block in the header of my template. It is suppose to be on the right, but for some reason, it is "underneath" my site's tagline.

I've tried editing it, moving the code around, but to no avail.

How do I get it so it is in the right corner at the top? (aligned opposite of my logo, but right above my sidebar) My code is in the header.php file.

The link is for my lightning shock site in my sig
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects

Last edited by jamestl2; 12-20-2007 at 02:41 PM..
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
 
Register now for full access!
Old 12-20-2007, 05:03 PM Re: aligning adsense in wordpress header?
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Use a CSS div, with an absolute position.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 12-20-2007, 05:06 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
I tried that, but I'm not even sure if I did that right, here is some of my header.php code:
Code:
<div id="header">
    <h1><a href="<?php echo get_option('home'); ?>/"><img src="http://www.lightningshock.com/wp-content/themes/royale-10/images/widelogo.png"></a></h1>
<div class="description"><?php bloginfo('description'); ?></div>

<div align="right">
<script type="text/javascript"><!--
google_ad_client = "pub-1372766692340749";
//200x200, created 12/20/07
google_ad_slot = "0862471633";
google_ad_width = 200;
google_ad_height = 200;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


    <ul class="pages">
        <li class="page_item"><a href="<?php echo get_option('home'); ?>/"><?php _e('Home','royale'); ?></a></li>
        <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=&exclude='.get_option('royale_exclude_pages')); ?>
    </ul>
</div>
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 12-21-2007, 12:07 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
Maybe I should have posted this in the CSS forum......... I'll request a move.
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 12-22-2007, 06:12 PM Re: aligning adsense in wordpress header?
OSWebMaster's Avatar
Super Talker

Posts: 136
Name: Scott Frangos
Trades: 0
Hi -
A link to your actual site would be helpful for diagnosis, since there may be parent or adjacent elements that are influencing the design.

- Scott
__________________
Scott A. Frangos, Technical Writer & BlogMaster
- Blog Services:
Please login or register to view this content. Registration is FREE

- BLOG:
Please login or register to view this content. Registration is FREE

OSWebMaster is offline
Reply With Quote
View Public Profile
 
Old 12-22-2007, 06:15 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
Quote:
Originally Posted by OSWebMaster View Post
Hi -
A link to your actual site would be helpful for diagnosis, since there may be parent or adjacent elements that are influencing the design.
Read this line

Quote:
Originally Posted by jamestl2 View Post
The link is for my lightning shock site in my sig
PS = I removed the adsense code for now, but that's where it was posted before, it was basically covering up my archives widget. If you have the proper code for it, or wanted to see it visually, let me know and I'll reinser it to where it was .
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects

Last edited by jamestl2; 12-22-2007 at 08:34 PM..
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 01-10-2008, 07:27 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
If anyone has any ideas, I'll still be open to any suggestions.
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 01-10-2008, 08:02 PM Re: aligning adsense in wordpress header?
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
James the code you have is actually fine, but you have to make one minor change. Float the div with the AdSense block like you have, but move that div above the code for your logo and tag line.

When you float something to the right it's top will align with the bottom of whatever came before it. With how you have it set it should display all the way to the right, but below the tag line.

If you move the html above the logo it will be aligned with the top of the header and be pulled out of the document flow so your logo and tag line should still have room to sit where they are.

If you find the ad block a little too high after moving the html you probably just need to add a little margin to the top.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 01-10-2008, 08:25 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
I believe I already tried that:
Code:
<div align="right">
<script type="text/javascript"><!--
google_ad_client = "pub-1372766692340749";
//200x200, created 12/20/07
google_ad_slot = "0862471633";
google_ad_width = 200;
google_ad_height = 200;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<div id="header">
    <h1><a href="<?php echo get_option('home'); ?>/"><img src="http://www.lightningshock.com/wp-content/themes/royale-10/images/widelogo.png"></a></h1>
<div class="description"><?php bloginfo('description'); ?></div>


    <ul class="pages">
        <li class="page_item"><a href="<?php echo get_option('home'); ?>/"><?php _e('Home','royale'); ?></a></li>
And I also tried putting it right after the <div id="header"> tag, but that produced weird results too.

The way my site was with that code is how it looks in this image:
http://www.jameslewitzke.com/images/csshead.bmp
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects

Last edited by jamestl2; 01-10-2008 at 09:23 PM..
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 01-10-2008, 10:07 PM Re: aligning adsense in wordpress header?
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Keep the AdSense code inside the header div, but before the h1 tag

HTML Code:
<div id="header">
 <div align="right">
 <script type="text/javascript"><!--
  google_ad_client = "pub-1372766692340749";
  //200x200, created 12/20/07
  google_ad_slot = "0862471633";
  google_ad_width = 200;
  google_ad_height = 200;
  //--></script>
  <script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  </script>
 </div>

 <h1><a href="<?php echo get_option('home'); ?>/"><img src="http://www.lightningshock.com/wp-content/themes/royale-10/images/widelogo.png"></a></h1>
 <div class="description"><?php bloginfo('description'); ?></div>
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 01-10-2008, 10:12 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
I did that too, but now the logo is "pushed down". Here's what it looks like:
http://www.jameslewitzke.com/images/csshead2.bmp

And the adsense is all the way to the right, I wanted it aligned with the sidebar, to give it the illusion that it continued above the right sidebar, in the header
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects

Last edited by jamestl2; 01-10-2008 at 10:16 PM..
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 01-10-2008, 10:22 PM Re: aligning adsense in wordpress header?
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
Take align="right" out of the div for the adsense code, and either give it a class or style it inline, see what that does.
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Old 01-10-2008, 10:24 PM Re: aligning adsense in wordpress header?
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
It looks like the h1 is stretching 100% across the header. You'll need to give it a width to match the image, though in all honestly you shouldn't use an h1 there in the first place. I think that's a WP default thing, but it's not a good thing.

Just remove the h1 from around the image. You may end up needing to add a little margin around the image to give it back what it's losing from the h1. I think the h1 gets 20px top and bottom by default so that's probably what you need to give to the image.

You can actually put the adsense div inside the h1 and it will probably work that way too, but again that h1 shouldn't really be there.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by vangogh; 01-10-2008 at 10:27 PM..
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 01-10-2008, 10:35 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
@Tim, it might work if I try that, but I'd have no idea what tags to use, I'm no coding expert.

@Steven, I tried putting it inside the h1 tag, and removing the h1 tag, but both produce the same result as the second image. So, what % should I shrink the h1 down to?
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects

Last edited by jamestl2; 01-10-2008 at 10:38 PM..
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 01-10-2008, 10:45 PM Re: aligning adsense in wordpress header?
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Are you sure you took out the h1 at the same time the AdSense code was before the image? I really think the h1 shouldn't be there.

But if you want to keep it try setting the width to whatever width the image is or maybe a couple of px wider. You might want to give that h1 an id or class and set the width only on the h1 with that id or class. Otherwise any other h1 you use is going to be that same width.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 01-10-2008, 10:48 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
Here is the code I tried that produced the same result:
Code:
<div id="header">

<div align="right">
<script type="text/javascript"><!--
google_ad_client = "pub-1372766692340749";
//200x200, created 12/20/07
google_ad_slot = "0862471633";
google_ad_width = 200;
google_ad_height = 200;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

    <a href="<?php echo get_option('home'); ?>/"><img src="http://www.lightningshock.com/wp-content/themes/royale-10/images/widelogo.png"></a>
<div class="description"><?php bloginfo('description'); ?></div>
And here is the h1 code in my style.css.php page (I think this is where I make the change, but I'm unsure):
Code:
/* End Structure */


/* Begin Headers */
h1 { padding-top: 15px; }

h2.pagetitle {
  margin-top: 30px;
  text-align: center;
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects

Last edited by jamestl2; 01-10-2008 at 10:52 PM..
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 01-10-2008, 10:56 PM Re: aligning adsense in wordpress header?
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
If you just take the align="right" out of the adsense div (which I think is deprecated anyway) you may not have to do anything. I'm sure one of us can tell you what to do to position it, but I think it'll just fall into place with the document flow without any.
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Old 01-10-2008, 11:00 PM Re: aligning adsense in wordpress header?
jamestl2's Avatar
No scale-itch here...

Latest Blog Post:
Wordpress Relative URLs Plugin
Posts: 2,389
Name: <member type="brilliant" alt="foolish">James Lewitzke</member>
Location: / public_html / Universe / Virgo_Supercluster / Local_Group / Milky_Way / Orion_Arm / Solar_System / Earth / North_America / USA / Wisconsin
Trades: 0
Taking align="right" out of the div gives me this result:
http://www.jameslewitzke.com/images/csshead3.bmp
__________________
Engipress -
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
for Wordpress Projects
jamestl2 is offline
Reply With Quote
View Public Profile Visit jamestl2's homepage!
 
Old 01-10-2008, 11:29 PM Re: aligning adsense in wordpress header?
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
Yeah, I see that. I'm looking at the CSS now. Part of it has to do with one of your other divs being vertically aligned to top. I'm tinkering with it now and will post back shortly.
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Old 01-10-2008, 11:45 PM Re: aligning adsense in wordpress header?
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Tim nice catch. I had it that the div was being floated, which I guess is why what I was saying wasn't working. Sorry James. My bad. Try this. It's similar to what I have above but removing h1 and then replacing align="right" with id="adsense"

HTML Code:
<div id="header">
 <div id="adsense">
 <script type="text/javascript"><!--
  google_ad_client = "pub-1372766692340749";
  //200x200, created 12/20/07
  google_ad_slot = "0862471633";
  google_ad_width = 200;
  google_ad_height = 200;
  //--></script>
  <script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  </script>
 </div>

 <a href="<?php echo get_option('home'); ?>/"><img src="http://www.lightningshock.com/wp-content/themes/royale-10/images/widelogo.png"></a>
 <div class="description"><?php bloginfo('description'); ?></div>

and then add this line to your css

div#adsense {float: right}

That's what I was thinking I was having you do before. I think it will work, but I'll keep checking in till we get it working.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to aligning adsense in wordpress header?

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.75351 seconds with 12 queries