Sizlopedia

How to Display Category Specific Content in Wordpress如何顯示類的具體內容在WordPress的

One thing I love about Wordpress is the great flexibility it offers in terms of designing custom themes and for this all the credit goes to Wordpress有一件事我喜歡的WordPress的是很大的靈活性,它提供從設計自定義主題,並為此所有歸功於WordPress的 Template Tags模板標記 .

Recently I ran into a problem where I wanted to monetize the posts in my Gadgets category with TTZmedia ads while keeping the normal Google Adsense ads on all other posts.最近我遇到了一個問題,我想賺錢的職位在我的小工具類TTZmedia廣告,同時保持正常的谷歌AdSense廣告的所有其他職位。 This is when I found the這是當我發現了 in_category template function which lets you display category specific content in Wordpress.模板功能,可讓您顯示類的具體內容在WordPress的。

The function is simple and very easy to use.功能非常簡單,非常易於使用。 Just use it in the Loop on any template file and it should work file.只要使用它在環路上的任何模板文件,並應工作檔案。

<?php if ( in_category('category_id') ): ?>
// Some category specific PHP/HTML here
<?php endif; ?>

More detailed info and examples can be found on the link below:更詳細的信息和例子可以發現下面的鏈接:

http://codex.wordpress.org/Template_Tags/in_category

This can be helpful to monetize posts from certain categories with specific ads and can also be used to display information about a particular category.這可以幫助賺錢員額從某些類別與特定的廣告,也可以用於顯示信息的一個特定類別。

A live implementation of this template function can be seen here on Sizlopedia.現場執行此模板功能可以看出這裡Sizlopedia 。 If you visit any post that belongs to the如果您訪問任何職位屬於 Gadgets小工具 category you will see targeted product ads while in other cases you will see the normal Google Adsense ads.類你會看到有針對性的產品廣告,同時在其他情況下,你會看到正常的谷歌AdSense廣告。

Comments評論

Thats a good trick.多數民眾贊成在一個良好的伎倆。 You can also use templates for categories, then you can style or display information specific to that category您還可以使用模板類,那麼你可以樣式或顯示信息的具體類別

Thanks a lot its really gonna help me in my search for latest stumbles for my site.多謝了其真正要去幫助我的搜索最新的失誤為自己的網站。

Interesting guide.有趣的指南。 Thanks for the detailed guide on how to embed Google Adsense Ads to categories.感謝您的詳細指導如何嵌入谷歌AdSense廣告的類別。 Is there other parts in Wordpress where you can embed Ads?是否有其他地方在WordPress的,您可以嵌入廣告?

@Rommel @隆美爾

The best position to embed Google ads is above the content and below the title of article.最佳位置嵌入谷歌廣告是上面的內容和下面的標題文章。 There you get the highest click through rates.在那裡,您獲得最高點擊率。

Leave a Comment發表您的評論

Name: (Required) 姓名: (必填)

E-mail: (Required) 電子郵箱: (必填)

Website: (Optional) 網址: (可選)

Comment: 評論: