Php 主页上也显示单贴广告
我在www.spiceygames.com域名上的广告有问题(该网站使用的是来自themeforest的创新科学2(cms)主题)。看看主页,下面是我的adsense广告 这些广告实际上是来自单篇文章,我将通过快速adsense插件添加它们,它们在单篇文章上运行良好 问题是在主页上,单贴广告也显示在主页上,我不想在主页上显示它们。我认为css/主题文件中有一些bug。那么我该如何修复它呢Php 主页上也显示单贴广告,php,css,wordpress,content-management-system,Php,Css,Wordpress,Content Management System,我在www.spiceygames.com域名上的广告有问题(该网站使用的是来自themeforest的创新科学2(cms)主题)。看看主页,下面是我的adsense广告 这些广告实际上是来自单篇文章,我将通过快速adsense插件添加它们,它们在单篇文章上运行良好 问题是在主页上,单贴广告也显示在主页上,我不想在主页上显示它们。我认为css/主题文件中有一些bug。那么我该如何修复它呢 <?php /********************************************
<?php
/**********************************************************************
* INNOVATION SCIENCE WORDPRESS THEME
* (Ideal For Business And Personal Use: Portfolio or Blog)
*
* File name:
* single.php
* Brief:
* Theme single page code
* Author:
* DigitalCavalry
* Author URI:
* http://themeforest.net/user/DigitalCavalry
* Contact:
* digitalcavalry@gmail.com
***********************************************************************/
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插件插入广告。您使用什么作为主页?页面/自定义模板/索引页面?您可以在adsense代码中添加一个条件块,将其显示在除主页外的所有页面上,如下所示:
<?php if ( ! is_home() ) {?>
<!--Ads1-->
<?php }?>
Ilich感谢您的回复。这是一个静态页面,位于wordpress cms上。按照链接,您将在下面找到“和”。但是我不知道该把代码放在哪里(,我的意思是,我可以把它添加到我的single.php或home.php吗???将它添加到你的home.php(编辑:你的行所在的位置),如果这是正在加载的文件,请仔细检查你是否没有使用常规页面作为主页。