Wordpress & Adsense

Discussion in 'PHP' started by JohnS0N, May 6, 2008.

  1. #1
    I'm using adsense with wordpress. I use the adsense manager plugin, but the code is not displayed as it should be. I'm not a coder, but I can fix some minor issues, so please give me guidance. The adsense manager ID where the link unit should be displayed is the "adsense2"

    Here is how it appears:

    [​IMG]

    header.php

    <?php
    /*
    Filename: 		header.php
    Date: 			06-06-25
    Copyright: 		2006, Glued Ideas
    Author: 		Christopher Frazier (cfrazier@gluedideas.com)
    Description: 	Multi-Author Template for WordPress (Subtle)
    Requires:
    */
    
    load_theme_textdomain('theme2');
    if (file_exists(dirname(__FILE__) . '/advert.php')) { include_once('advert.php'); }
    
    if (is_home()) { $sMenuHome = 'current_page_item'; } else { $sMenuHome = 'page_item'; }
    
    if (is_archive()) { $sMenuArchive = 'current_page_item'; } else { $sMenuArchive = 'page_item'; }
    
    $aOptions = themebustathief::initOptions(false);
    if (!file_exists(get_theme_root() . '/' . get_template() . '/styles/' . $aOptions['style'])) {
    	$aOptions['style'] = 'default';
    }
    
    // If the style has a header that needs generating, do it.
    $sStyleFolder = get_theme_root() . '/' . get_template() . '/styles/' . $aOptions['style'] . '/';
    if (file_exists($sStyleFolder . 'generator.php')) {
    	include_once($sStyleFolder . 'generator.php');
    	$sStyleCSS = getHeaderCSS($sStyleFolder);
    } else {
    	$sStyleCSS = '';
    }
    
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <title><?php if (is_home()) { bloginfo('name'); ?><?php } elseif (is_category() || is_page() ||is_single()) { ?> <?php } ?><?php wp_title(''); ?></title>
    <meta http-equiv="imagetoolbar" content="no" />
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <link href="<?php bloginfo('stylesheet_directory'); ?>/styles/<?php if (isset($aOptions['style'])) { echo($aOptions['style']); } else { echo('default'); } ?>/style.css" rel="stylesheet" media="all" type="text/css" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php wp_head(); ?>
    </head>
    <body>
    <div id="wrap">
    	<div id="header">
    		<ul id="menu">
    			<li><a href="#">Email</a></li>
    			<li><a href="#">About</a></li>
    			<li><a href="<?php echo get_settings('home'); ?>/">Home</a></li>
    		</ul>
    		<div id="hd-inner">
    			<h1><a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?><span></span></a><span id="des"><?php bloginfo('description'); ?></span></h1>
    		</div>
    		<div class="extra"></div>
    		<a href="<?php bloginfo('rss2_url'); ?>" id="rss"></a>
            
            
            <div style="padding-top: 15px; padding-left: 15px;">
            <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("topads") ) : ?>
    			<?php 
    							if(function_exists('adsensem_ad')){ 
    								adsensem_ad("adsense2"); 
    							} 
    							else
    							{
    							?>
                                        
    		<ul id="links">
    			<li><a href="#">Text Ads</a></li>
    			<li><a href="#">Image Ads</a></li>
    			<li><a href="#">Video Ads</a></li>
    			<li><a href="#">Link Units</a></li>
    		</ul>
    
                                <?
    							
    							}
    						?>
    				
    		<?php endif; ?>
            </div>
    
    	</div>
    	<div id="main">
    		<div id="content">
    Code (markup):
    style.css

    Download Here
     
    JohnS0N, May 6, 2008 IP
  2. sphere

    sphere Well-Known Member

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    118
    #2
    Could you provide your url so I can check on my side? I think your code is correct, It might be the problem in Google side, they can't find enough link for you related to your content.
     
    sphere, May 6, 2008 IP
  3. JohnS0N

    JohnS0N Notable Member

    Messages:
    1,581
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    210
    #3
    http://www.iattackanxieties.info/blog/

    There is enough ads for this content, as you see I have other adsense units and there is plenty of advertisers. This issue is making me worried that adsense might think I'm trying to change their code...

    Thanks a lot sphere for looking at my issue.
     
    JohnS0N, May 6, 2008 IP
  4. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    How long ago did you add it?

    Don't worry about Google thinking you've changed you code. It's a pretty open thing, so they don't usually worry about that.

    I'd guess it's more a problem of ad synchronization with the new slot.
     
    Altari, May 6, 2008 IP
  5. JohnS0N

    JohnS0N Notable Member

    Messages:
    1,581
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    210
    #5
    Thanks for jumping in Atari. I've had it there for a couple of days and trying to fix it ever since. I'm looking at the code and can't see a thing that would cause this error and its driving me crazy. I'm using adsense since 2005 on numerous websites and haven't experienced this before.
     
    JohnS0N, May 6, 2008 IP
  6. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    OK, cool. Let me take a look at the Adsense Manager Plugin. I'll see if there's something potentially weird in there...

    Which version are you using?
     
    Altari, May 6, 2008 IP
  7. JohnS0N

    JohnS0N Notable Member

    Messages:
    1,581
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    210
    #7
    I'm using the latest one from wordpress plugins here.
     
    JohnS0N, May 6, 2008 IP
  8. sphere

    sphere Well-Known Member

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    118
    #8
    I can only see one link "Panic Attacks"
     

    Attached Files:

    sphere, May 6, 2008 IP
  9. sphere

    sphere Well-Known Member

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    118
    #9
    Have you tried to put adsense code inside the template without using adsense manager? If you can see 4 links there must be something wrong with adsense manager.
     
    sphere, May 6, 2008 IP
  10. JohnS0N

    JohnS0N Notable Member

    Messages:
    1,581
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    210
    #10
    Click on a navigation link or two. You will see that sometimes it displays one link and sometimes two. Weird, huh?

    I've tried that to no avail. No matter if I place the adsense code right into the header.php or in adsense manager, it doesn't work properly.
     
    JohnS0N, May 6, 2008 IP
  11. JohnS0N

    JohnS0N Notable Member

    Messages:
    1,581
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    210
    #11
    Anyone? I need this fixed and will pay for the solution, please take a look!
     
    JohnS0N, May 6, 2008 IP