Free Checking for Bloggers - Sign up in 5 Minutes! 免費檢查的博客-註冊在5分鐘!
Powered by MaxBlogPress 由maxblogpress

在WordPress哈克# 15 :黑客入侵的WordPress標籤| jtpratt的博客失誤
jtpratt的博客失誤


Home » Wordpress Hack #15: Hacking Wordpress Tags WordPress所哈克# 15 :黑客入侵的WordPress標籤



Posted in: 張貼在:

博客安裝類的形象在WordPress類的形象
549 views 549的意見


Please note: This page was originally written in English.請注意:此頁中,原本以英文書寫。

The original post can be viewed原來的文章可以看 here這裡 .

Please note: This page was originally written in English.

The text has been translated using an online service such as Google or Babelfish.

The original post can be viewed here.


Today we’ll learn How to add Tag Support by hacking your Wordpress theme! 今天,我們將了解如何在顧客的支持,您的黑客的WordPress主題!

This is day #15 of這是天# 15 30 Wordpress Hacks in 30 Days 30日在WordPress駭客在30天內 .

If you’re using Wordpress 2.3x or 2.5 or higher you have the ability to use “tags”.如果您使用的WordPress 2.3x或2.5或更高,你有能力使用“標籤” 。 If you use social media at all, you should already know what a tag is.如果您使用的社會,媒體,你應該已經知道什麼是標記。 Basically it’s just a piece of metadata, a “descriptor” of some kind.基本上它只是一塊中繼, “廣義”某種形式的。 When you blog, it’s also another way to pigeonhole and file your content.當您博客,這也是另一種方式歸檔和檔案您的內容。 The implementation of tags in Wordpress is very important, because it keep people from “using categories as tags” as many of us have done over the years.實施標籤在WordPress是非常重要的,因為它使人們從“使用類別標籤”我們很多人都做了多年來。 There were dozens of plugins available to add tags to your Wordpress blog, but now all that functionality is available without using any plugins at all.有幾十個插件可將標記新增到您的WordPress所博客,但現在所有的功能可用,而不使用任何外掛程式在所有。

Think of categories as high level descriptions.認為類作為高層次的說明。 What do you like to blog about?你怎麼想博客呢? Movies, Music, Politics, and Web Design.電影,音樂,政治,和網頁設計。 Those are categories.這些都是分類。 However, when you blog - the tags would be Obama, John Candy, AC/DC, and HTML.然而,當您博客-標籤將奧巴馬,約翰糖果,交流/直流,和H TML。 Get it?怎麼做呢? All you have to do is enter description tags when you blog, along with a category.所有您需要做的就是輸入說明標記時,您的博客,隨著一類。 Now you’re probably wondering, what do I do with that information?現在,您可能不知道,我該怎麼做,與資料?

Depending on how old your theme is it may or may not have “tag support”, which means that it might not be coded to do anything at all with those tags you’re entering.視如何歲您的主題是,它可能會或不會有“標記的支持” ,這意味著它可能不是編碼做任何事情都與這些標記您輸入的。 The first thing you can do is to add a (now famous) “tag cloud” in your side bar like I did, with this code:第一件事,你可以做的是添加一個(現在著名的) “標記的雲”在您的側欄一樣,我本來,與此代碼:

 <?php if ( function_exists('wp_tag_cloud') ) : ?> <li> <h2>Popular Tags</h2> <ul> <?php wp_tag_cloud('smallest=8&largest=22'); ?> </ul> </li> <?php endif; ?> < ? PHP的,如果( function_exists ( ' wp_tag_cloud ' ) ) : ? > <li>在<h2>快來流行標籤< /氫氣> <ul> < ? PHP的wp_tag_cloud ( '最小= 8 &最大= 22 ' ) ; ? > < / UL認證> < /李> < ? PHP的endif ; ? > 

If you want to know more about how that codes works and how you can modify it, visit the如果你想知道更多關於如何行為守則工程,以及如何可以修改它,請訪問 Wordpress Codex Tag Cloud Page在WordPress法典標記雲彩頁 .

Another thing you can do is to add the tags you used beneath your post by adding some code to your single.php file (for single posts).另一件事,你可以做的是添加標記您所使用的下方,您的帖子加入一些代碼到您的single.php文件(單一的職位) 。 You could do it on your index.php home page as well, but I don’t much see the point in that.你可以這樣做您的index.php的首頁,以及,但我並不見得多一點,在這方面。 All you have to do is add the following code near the end of the loop to display the tags used at the end of the post:所有您需要做的就是將以下代碼添加到臨近結束時循環顯示所用的標記在去年底,郵政:

 <?php the_tags('<p>Tags: ', ', ', '</p>'); ?> < ? PHP的the_tags ( ' <p>標籤: ' , ' , ' , “ < / > ” ) ; ? > 

So, now we’ve talked about how to modify your theme to add the tags used after a post, and how to place a tag cloud in your sidebar (without using a plugin).所以,現在我們已經談到如何修改您的主題添加所用的標記後,郵政,以及如何設立一個標記雲彩在您的工具欄(不使用插件) 。 Click on one of the links in my post (to a tag) or my tag cloud and you’ll see (much like a category page) it goes to a “tag” page, or something like site.com/tag/wordpress-hack.按一下其中一個鏈接,在我的職務(標記)或我的標記雲彩,你會看到(很像一個類別頁)這是不言而喻一個“標籤”網頁,或類似的東西site.com/tag/wordpress-哈克。

Be default Wordpress will look for the “tag.php” file (that most themes don’t have), and if there isn’t one your archive.php will be used by default.被默認的WordPress將尋找“ tag.php ”文件(即大多數主題沒有) ,如果沒有您的一archive.php將默認使用的。 You could just leave this as-is, or create your own custom “tag.php” to make your tag pages unique.你可以離開這-是,或創建自己的自定義“ tag.php ” ,使您的獨特標記的頁面。 One way to do this would be to add a “tag cloud” to the top of each tag page.方法之一,為此將新增一個“標籤雲” ,以頂部的每個標籤頁。 The那個 Wordpress Codex Tag Page在WordPress法典標籤頁 has more information on creating a custom tag.php file for your theme.有更多的資料,建立自訂的tag.php文件為您的主題。

This post was all about “how to add tag support to your Wordpress theme”.這個職位是所有關於“如何添加標記支持您的WordPress的主題” 。 In a future post, I’ll show you what you need to know about tagged pages and Wordpress SEO.在未來的職位,我會告訴您什麼您需要了解的有關標記的頁面,並在WordPress徐。 As always, if you have something to add to make this post better, or a question - comment now!一如往常,如果你有一些補充,使這個職位的更好,或一個問題-評現在!


Tags:標籤: , , , , ,

9 Responses to “Wordpress Hack #15: Hacking Wordpress Tags” 9反應“的WordPress哈克# 15 :黑客入侵的WordPress標籤”

  1. unique articles 獨特的文章 Has the following to say...有下列說...

    You have a really good tutorial there quick and easy to follow, you should amke it into an article and do some article submissions with it to attract more people to your site.您有一個真正好的補習有更為輕鬆,快捷地跟進,你應該使它成為一篇文章,做一些文章的意見書與它,以吸引更多人到您的網站。

    Really like that and keep up the good work :)真的很喜歡,並保持了良好的工作: )

    unique articless last blog post..獨特的articless最後的博客帖子.. The Art Of Online Writing藝術在線寫作

  2. Erika 艾莉卡 Has the following to say...有下列說...

    LOL I was just looking for this yesterday! lol ,我只是在尋找這昨天! Thanks for the little tidbit!感謝小tidbit !

    Erikas last blog post..1 erikas最後的博客帖子.. 1

  3. CJ 終審法院首席法官 Has the following to say...有下列說...

    Categories are nice to start your site off.分類尼斯開始您的網站關閉。 Use the descriptions of the categories to add keyword content like JT talks about and then the tags to get specific.使用說明類別添加關鍵字的內容,像是日本煙草公司談,然後標記,以獲得具體的問題。 I don’t add tags till I have some pages going.我不添加標記,直至我有一些的頁面去。 . . looks bad to have one post in ten places.看來不好,有一個職位在10的地方。

    I haven’t found a problem with duplicate content using tags.我沒有發現的問題與重複的內容使用的標記。 I know it’sa big topic but google seems to be ok with tags.我知道這是大的話題,但Google似乎是確定與標記。 I’ve been adding tons on my wordpress.com blog and haven’t seen any problems.我已經加入噸,對我的wordpress.com的博客並沒有看到任何問題。 However, I do like to keep them to a smaller number on my main blogs but I’ve seen others that use them by the truck loads.不過,我想,讓他們到一個較小的數目對我的主要博客,但我看過別人使用他們的卡車荷載。

    CJs last blog post.. cjs最後的博客帖子.. Sorbs sorbs

  4. CJ 終審法院首席法官 Has the following to say...有下列說...

    Update:更新:

    Just spent the past few days studying up on tags, technorati, and other blog search engines.剛剛度過了過去數天,學習了關於標籤,來Technorati ,和其他博客搜索引擎。

    First, we all should be using the rel-”tag” (note that - should be an首先,我們都應該使用相對- “標記” (請注意, -應該是一個 = sign) on all our links that have key words.簽署)對我們的所有環節,有關鍵詞。 Many of those links you may not want to have a tag for your visitors to follow.許多這些鏈接,您可能不希望有一個標記,為您的訪客遵循。 This works well with blog search engines, also.這個工程,以及與博客搜索引擎,也。 This allows your keywords to be tagged without needing to put a tag at the bottom of your post這可以讓您的關鍵字進行標記,而不需要提出一個標記在底部您的帖子

    Remember that technorati uses + while wordpress uses - between words.記得來Technorati使用+ ,而在WordPress的用途-在字與字之間。 Technorati also uses the - for tags but they aren’t the primary tags, thus a multi word tag on technorati should be worda+wordb+wordc while that will be worda-wordb-wordc on wordpress.來Technorati也使用-為標記,但它們不是首要標記,因此,一個多字的標記來T echnorati應w orda+ w ordb+ w ordc,而這將是w orda- w ordb- w ordc就在W ordPress。

    Here’s the problem.這裡的問題。
    You cannot link within a post to your technorati tag (worda+wordb+wordc) because wordpress will remove the + and you get wordawordbwordc您無法鏈接一張貼到您來Technorati標記( worda + wordb + wordc ) ,因為在WordPress將刪除+你會得到wordawordbwordc

    Not what you really want.沒有什麼你真的想。

    Let me see if I can make this clearer.讓我看到如果我可以使這個清晰。
    You may want to hyperlink keywords within the post but not leave your site and have no real post to link to, thus you would love to link to that tag, right?您可能會想要超連結的關鍵字後,但不離開您的網站,並沒有實質後,才能鏈接到,因此,你會愛連結到這個標記的,對不對? Well, to have that tag be equal to technorati you want to us a “+” between words, but you can’t do that in a wordpress link.好,有這個標記的一律平等,要來Technorati你想我們一個“ + ”字與字之間,但你不能這樣做,在一個WordPress所連結。 Wordpress will remove the +.在WordPress將刪除+ 。
    The only way to link keywords to a tag page in wordpress is to seperate words with a -唯一的出路,以鏈接的關鍵字,以一個標記的網頁在WordPress是分開的話-
    That’s the same way wordpress sees your tags, categories, and everything else.這是同樣的方式在WordPress看到您的標籤,分類,和一切。 WordPress always uses - while technorati used a +在WordPress始終用途-雖然來T echnorati用+

    The only real way to stay on your site and use the + is to link the keywords to a search function (hyperlink like normal but end with index.php?s=wordsa+wordb” rel-”tag”) This will then cause a search function on your site for that tagged words in the hyperlink唯一真正的途徑留在您的網站和使用+是要連結的關鍵字搜索功能(超鏈接一樣正常,但與年底的index.php ? = wordsa + wordb “的rel - ”標記“ ) ,這就會造成搜索功能在您的網站上為標記的話,在超連結

    This is a long way to say, on wordpress you will never have a tag “page” that is equal to a tchnorati tag because wordpress doesn’t allow the use of + as a separator between words.這是一個很長的路說,就在WordPress您將永遠有一個標記“頁” ,也就是相當於一個tchnorati標記,因為WordPress所不容許使用+作為分隔符字與字之間。

    CJs last blog post.. cjs最後的博客帖子.. Akismet Spam akismet垃圾郵件

  5. Make Online Money 做網上金錢 Has the following to say...有下列說...

    Nicely done.很好的工作要做。 Most of my blog ‘marketing’ is done through social bookmarking.我大部分的博客'營銷'工作是通過社會書籤。 (I use socialmarker.com to broadcast to multiple bookmarking sites at once.) I really like your ideas here. (我用socialmarker.com廣播到多個書籤的網站。 )我真的很喜歡您的想法在這裡。

    Make Online Moneys last blog post..使網上的款項最後的博客帖子.. Profit from Poo利潤由公安條例

  6. Trying Hard 努力 Has the following to say...有下列說...

    I’ll consider adding something like the tag cloud, but I really don’t like the look of it.我會考慮加入這樣的東西標記雲彩,但我真的不喜歡的外觀。 I’d prefer it to show the more popular tags increasingly darker and darker, but the same font.我更希望它顯示出較受歡迎的標籤越來越多的前程,黑暗的,但相同的字體。 Any chance you’ve seen one like this I could use?任何的機會,你看過一想,這點我可以使用?

    Trying Hards last blog post..試圖hards最後的博客帖子.. Preparing Safety Posts準備安全的職位

  7. Chris Hunt 克里斯亨特 Has the following to say...有下列說...

    Trying Hard - try installing the “Simple Tags” plugin, it lets you customise the appearance of tag clouds and do all sorts of other clever things with tags.努力-嘗試安裝“簡單的標籤”插件,它可以讓您自訂的外觀標記的雲朵和做各種其他的東西,聰明與標記。

  8. Trying Hard 努力 Has the following to say...有下列說...

    I’ll check that out.我會檢查了這一點。 Thanks.謝謝。

    Trying Hards last blog post..試圖hards最後的博客帖子.. Multiple Ideas Mashed Into One Topic多重的想法搗碎成的一個話題

  9. Blog for Beginners 博客對於初學者 Has the following to say...有下列說...

    I am yet to see the benefit of using tag cloud.我還沒有看到有利於使用標記雲彩。 Maybe I’m wrong but for now I don’t like to clutter my sidebar with it.也許我是錯,但現在我不喜歡雜波我的工具欄與它。

    Blog for Beginnerss last blog post..博客為beginnerss最後的博客帖子.. Yet Another 8 CSS Tips For Your Blog又一8 CSS的提示為您的博客

Question or Comment??問題或意見嗎? Spill it Now...溢漏,現在...

跳躍的喜悅,為超過評論!

We Reward Comments!我們懸賞的評論!


We dofollow links, and get your latest blog post as a byline under every new comment from the "CommentLuv" plugin!我們dofollow聯繫,並獲得最新的博客帖子作為一個署名下,每一個新的評論從“ commentluv ”插件! Top commenters for every month are listed on every page of this site in a sidebar widget linked back to your URL!頂端提意見,每一個月中列出的每一頁上這個網站,在工具欄的小裝置相連回到您的網址! We would like to reward you for becoming part of our community!我們想獎勵你的一部分,成為我們的社會! Your comment is valuable not only to us, but also all the other readers of this blog!您的評論是有價值的,不僅給我們,而且所有其他的讀者,這博客!


Click to add smilies to your post! 按一下以新增的笑臉到您的帖子! == [ ]^ = (= ( (= ( |= )規例= | 8= 0= ) 〜= 00= (= ; ;= ) ]= ; ; ;