How to Display Elements (Ads) Only On (Or Only Not At) Individual Single Post Item View如何显示元素(广告) ,只(或只有不)个别单一邮政项目的看法
Blogger.com, a popular free blog publishing service from Google, has a extremely easy to use and convenient template system that allows users to design the blog user interface presentations by selecting a theme and then drag and drop various page elements such as poll, newsreel, video bar, feed, label, logo, AdSense, HTML/JavaScript and more to align them according to users’ preference on blog layout. blogger.com后,受欢迎的免费博客出版服务由Google提供,有一个非常易于使用和方便的模板系统,允许用户设计的博客用户界面介绍选择一个主题,然后拖放各种网页元素,例如民意调查,新闻短片,视频酒吧,饲料,标签,标识, AdSense的的HTML / JavaScript和更使他们根据用户的喜好对博客布局。 However, it also comes with serious limitations, such as when you want to make certain elements (ie Google AdSense ad unit) to appear and show when visitors visit single post item individually, or just want to shown the widget component block on homepage, archive and label or category pages.然而,它也具有严重的局限性,例如当您想要让某些要素(即Google AdSense广告的单位)出现并显示,当访客造访的单一项目后单独,或者只是想表明,该Widget组成阻滞对网页,存档和标签或类别的页面。
Blogger.com allows users to manually the XML-based template HTML, thus allows a hack which enables users to manually edit the HTML code to achieve the aim to display and show certain widgets or part of webpages on individual post page view only. blogger.com允许用户以手动方式基于XML的模板,从而允许黑客使用户以手动编辑HTML代码,以便达到目的,以显示和显示某些widgets或部分网页就个别帖子页只查看。 However, you have need to have a basic HTML knowledge to modify the HTML code of Blogger’s template, which as editable by clicking on Template tab (or Layout of the blog you want to change if at Dashboard), and then click on Edit HTML .不过,您有需要有一个基本的HTML知识,要修改的HTML代码Blogger的范本,作为编辑按一下模板标签(或布局的博客您想要变更的,如果在仪表板) ,然后按一下编辑HTML格式 。
The trick is show a widget in single post item view only is to add the following two lines of code to the top and bottom of the code block respectively:诀窍在于显示窗口小部件在单一项目后的看法,不仅是要添加以下两行代码,顶部和底部的代码块分别是:
<b:if cond='data:blog.pageType == "item"'> <b:if cond='data:blog.pagetype == "item"'>
</b:if> < /乙:如果>
The above lines will add in a condition which value is negative is the blog is not showing individual post content page.上述线路将增加在一个条件,其中的价值是否定的是博客是不会显示个别文章内容网页。 Thus anything that are wrapped inside it won’t be shown on homepage, label or category pages, or archive pages.因此,任何包裹内将不会出现在网页上,标签或分类网页,或存档的页面。 For example, while例如,虽然 wrapping the AdSense ads manually beside the post content包装AdSense广告手动旁张贴内容 , you can make the ads displayed only when individual posts are viewed by adding above 2 lines to the code, so that it will has the following structure: ,您就可以让显示的广告,只有当个别职位来看,加入上述二行代码,因此,它将具有以下的结构:
<b:if cond='data:blog.pageType == "item"'> <b:if cond='data:blog.pagetype == "item"'>
Parsed Google AdSense Ad Code (guide to剖析Google AdSense广告代码(指南 parse the HTML code of AdSense JavaScript with escape character解析HTML代码的AdSense的JavaScript与转义字符 ) )
</b:if> < /乙:如果>
To display the page elements or ad units on every pages except individual post content view pages, wrap the following lines of code instead:以显示该网页的内容或广告的单位对每一个网页,除个别职位内容查看的页面,总结下列几行代码:
<b:if cond='data:blog.pageType != "item"'> <b:if cond='data:blog.pagetype != "item"'>
</b:if> < /乙:如果>
The above statements make use of conditional statements similar to IF, ELSE, END IF in most programming languages.上述报表使用条件语句类似,如果,否则,如果年底,在大多数的编程语言。 The Blogger XML support these three conditional statements too. Blogger的XML支持这三个条件语句。 Two already been used above, with the third one ELSE is <b:else>.二已经被用来以上,与第三人是<b:else> 。 You can make use of <b:else> to instruct Blogger template to display this widget (eg AdBrite ads) on all pages except single post pages, and show another widget (eg AdSense ads) on individual post pages.您可以使用<b:else>指示Blogger模板,以显示这个窗口小部件(例如adbrite广告)的所有网页上,除单一的帖子页,显示另一窗口小部件(例如, AdSense广告)就个别后的页面。
Other than ads code or JavaScripts that are manually inserted into Blogger HTML, the above trick can be applied to widget based page elements that are added to the layout.以外的其他广告代码或javascripts是手动插入到Blogger的HTML ,上述的伎俩,可用于小装置为基础的网页内容,都被添加到布局。 But you need to study carefully the HTML code to identify which blocks of code is the element in order to add in above codes to wrap on top and bottom around them.但您需要仔细研究的HTML代码,以确定哪些块代码是元素,以添加在上述守则,以总结对顶部和底部靠近他们。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明 :这是一个机器翻译网页是“按原样”提供的担保。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article原来的英语文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和贡献,或取得技术的支持和帮助,在 My Digital Life Forums 我的数字生活论坛 . 。
Related Articles相关文章
- Move Blogger Inline Ads Between Posts to Inside Within Post Position动议的Blogger内插广告之间的员额内后的立场
- How to Wrap AdSense Ads Around and Inline Beside Blogger Post Content如何总结AdSense广告约和内置旁边的Blogger帖子内容
- Place AdSense Ad Unit In Various Positions Inside Within Blogger Post Contents地方AdSense广告单元在各个据点内的Blogger帖子内容
- Retrieve and Get WordPress Post ID Outside the Loop as PHP Variable检索和获取的WordPress张贴ID以外的回路作为PHP变量
- Change to ads about Feature in Google Adsense Ads改变广告约功能在Google AdSense广告
- Video Ads Support in Google Adwords and Adsense视频广告支持,在Google的AdWords和AdSense
- Adding Extra More Fields to WordPress Write/Edit Post/Page Right Column加入额外的更多领域的WordPress写/编辑帖子/页右边一栏
- Trick to Add AdSense, AdBrite and Other JavaScript Ad Code Directly to Blogger HTML Template伎俩AdSense新增, adbrite和其他JavaScript广告代码直接到Blogger HTML模板
- Paginating or Split WordPress Post or Page with NextPage in WordPress Not Working paginating或分裂的WordPress邮寄或网页下一页在WordPress没有工作
- Add and Insert to Put Google AdSense Ads Units Between Blog Posts in Blogger.com新增和插入把Google AdSense广告单位之间的博客帖子在blogger.com

































October 3rd, 2007 01:17 2007年10月3日1时17分
[...] Note that you can also make the ads appear only on single post view. [ … … ]注意,您也可以使广告只会出现在单一的工作地点的看法。 [...] [ … … ]
November 5th, 2007 02:20 2007年11月5日2时20分
Thanks.谢谢。 That helped.帮助。
January 2nd, 2008 16:45 2008年1月2日16时45分
Do u have any idea how the same thing can be done using the classic template in blogger?做u有任何想法如何同一件事可以做使用经典模板在Blogger吗?
The if condition to check for?如果该条件,以检查?
January 13th, 2008 01:32 2008年1月13日1时32分
I used我用
(if(in_category(CATID)) (如果( in_category ( catid ) )
{ (
} )
Works great伟大的工程
April 11th, 2008 01:29 2008年4月11日1时29分
I’ve tried but code is automatically set to:我试过,但代码会自动设定为:
test display 测试显示
My aim is to display “test display” only on homepage.我的目标是要显示“测试显示, ”只有对网页。
May 6th, 2008 22:19 2008年5月6日22时19分
Hi,嗨,
I like to play with html, and location of adsense on my blogs.我喜欢玩的HTML ,和位置的AdSense对我的Blog 。 I chanced upon your post and implemented the code to appear on a single post. i偶然后,您的文章并实施了代码出现在一个单一的工作地点。 Then I got a new template and I had to start all over again.So now I have bookmarked your post, for future reference.然后我得到一个新的模板和我开始,所有超过again.so现在我已书签您的文章,以供日后参考。 Great post.伟大的职位。
May 30th, 2008 02:30 2008年5月30日2时30分
this is what i looking for.这是我在寻找。 thanks for help.感谢您的帮助。
August 16th, 2008 23:54 2008年8月16日23时54分
Thanks a lot..this trick is very useful to me..感谢了很多..这一招是非常有益的,我..
September 7th, 2008 21:20 2008年9月7日21时20分
This is an extremely well article and whatever saying here in intact while going to real time basis.这是一个非常出色的文章,无论在此间说,在完整的同时,要实时性的基础上。 My appreciations to giving such terrific information and the well written style.我赞赏让这种可怕的信息和写得不好的作风。 Nice work.尼斯的工作。
I have placed ad sense by following the instructions given here and it is working fantastic without a second involvement.我已放置的广告意识,按照下列指示在这里,而且是工作幻想没有第二的参与。
Many thanks from my end.许多感谢从我的结束。
Sherin from Investinternals谢林从investinternals