2011-09-11 67 views
0

我在域www.spiceygames.com(本網站使用來自themeforest的創新科學2(cms)主題)上的廣告出現問題 請看一看在主頁面上,顯示下面的滑塊我的AdSense廣告。 這些廣告實際上來自單個帖子,我會通過快速adsense插件添加它們,並且它們在單個帖子中工作得很好。 問題出在主頁上,單帖廣告也顯示在主頁面,我不想在主頁面上顯示它們。我認爲在CSS /主題文件中存在一些錯誤。那麼我該如何解決它?需要緊急幫助,提前感謝對不起我的英語不好:)單頁廣告主頁上也顯示(需要修復)

<?php 

/* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * *** *創新科學WordPress主題
*(適用於商業和個人用途:投資組合或博客)
* *文件名:
* single.php中 *產品簡介:
*主題單頁代碼 *作者:
* DigitalCavalry *作者URI: * http://themeforest.net/user/DigitalCavalry *聯繫人: * [email protected]
* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ****/

get_header();   

$catlist = wp_get_post_categories($post->ID); 
$catlist = wp_get_post_terms($post->ID, 'category'); 
$count_cat = count($catlist); 

$extname = array(); 
if($count_cat > 0) 
{  
    foreach($catlist as $cat) 
    { 
     $extname[$cat->name] = get_category_link($cat->term_id); 
    } 
} 

if(!isset($_SESSION[('pv'.$post->ID)])) { $_SESSION[('pv'.$post->ID)] = false; } 
if(isset($_SESSION[('pv'.$post->ID)]) and $_SESSION[('pv'.$post->ID)] == false) 
{ 
    $post_visits = get_post_meta($post->ID, 'post_visits', true); 
    if($post_visits == '') { $post_visits = 0; } else { $post_visits++; } 
    update_post_meta($post->ID, 'post_visits', (int)$post_visits); 
    $_SESSION[('pv'.$post->ID)] = true; 
}             

>

<!-- google_ad_section_start --> 
<div id="content">    
    <?php 


     $post_common_opt = $GLOBALS['dc_postcommon_opt'];    
     $post_custom_content = (bool)$post_common_opt['post_custom_cbox']; 
     $post_fullwidth = (bool)$post_common_opt['post_fullwidth_cbox']; 

     if($post_custom_content and $post_fullwidth) 
     { 
      echo '<div class="page-width-full">';   
     } else 
     { 
      GetDCCPInterface()->getIGeneral()->includeSidebar($post_common_opt['page_sid'], $post_common_opt['page_sid_pos']); 

      if(GetDCCPInterface()->getIGeneral()->getSidebarGlobalPos($post_common_opt['page_sid_pos']) == CMS_SIDEBAR_RIGHT) 
      { 
       echo '<div class="page-width-left">';        
      } else 
      { 
       echo '<div class="page-width-right">';  
      } 
     }  
     dcf_naviTree($post->ID, 0, '', $extname);   

     if($post_custom_content) 
     { 
      the_content();  
     } else 
     {   
      GetDCCPInterface()->getIRenderer()->renderBlogPostFull(); 
     } 

     if('open' == $post->comment_status) 
     { 
      echo '<a name="comments"></a>'; 
      comments_template(); 
     } 
    ?> 

注 - 我會用簡單的AdSense的WordPress插件插入廣告。

回答

0

你在做什麼主頁?一個頁面/自定義模板/索引頁面?您可以在條件塊添加到您的AdSense代碼,以顯示它的所有網頁,除了主頁,就像這樣:

<?php if (! is_home()) {?> 
    <!--Ads1--> 
<?php }?> 
+0

伊里奇感謝您response.It是靜態頁面,它是WordPress的cms.Follow的鏈接,你會undertsand http:// themeforest。淨/項目/ innovationscience -2-先進的WordPress主題/ 93906。但我不明白在哪裏放這段代碼(<?php if(!is_home()){?>,我的意思是我可以將它添加到我的single.php或home.php中嗎? –

+0

將它添加到您的家中.php(編輯:您的行所在的位置),如果這是正在加載的文件,請再次檢查您是否將常規頁面用作主頁。 –