Posted in: 张贴在:
534 views 534的意见
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:标签: codex食品法典委员会 , , support支持 , , tag.php , , tags标签 , , theme主题 , , wordpress-hack在WordPress -哈克






















May 15th, 2008 at 3:44 pm 2008年5月15日在下午3时44分
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艺术在线写作
May 18th, 2008 at 1:31 pm 2008年5月18日在下午1时31分
LOL I was just looking for this yesterday! lol ,我只是在寻找这昨天! Thanks for the little tidbit!感谢小tidbit !
Erikas last blog post..1 erikas最后的博客帖子.. 1
June 2nd, 2008 at 1:43 pm 2008年6月2日在下午1时43分
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
June 5th, 2008 at 11:40 am 2008年6月5日在上午11时40分
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垃圾邮件
June 6th, 2008 at 6:44 am 2008年6月6日在上午06时44分
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利润由公安条例
June 7th, 2008 at 3:12 pm 2008年6月7日在下午3时12分
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准备安全的职位
June 9th, 2008 at 5:09 am 2008年6月9日在上午05时09分
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.努力-尝试安装“简单的标签”插件,它可以让您自订的外观标记的云朵和做各种其他的东西,聪明与标记。
June 10th, 2008 at 12:40 pm 2008年6月10日在下午12时40分
I’ll check that out.我会检查了这一点。 Thanks.谢谢。
Trying Hards last blog post..试图hards最后的博客帖子.. Multiple Ideas Mashed Into One Topic多重的想法捣碎成的一个话题
June 11th, 2008 at 11:05 am 2008年6月11日在上午11时05分
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的提示为您的博客