数字化技能提升教程,数字化时代生存宝典

数字化百科 / 产品文档 / WordPress:Designing Themes for Public Release

WordPress:Designing Themes for Public Release

查看全部产品文档命名空间:WordPress

As open source code, WordPress developers like to keep things loose when it comes to what a user does with WordPress. However, when it comes to designing your styles or Themes for contests and public consumption, there are a few things you should take into consideration. These are not hard and fast rules, they are more guidelines, on how to make your Theme the best it can be before exposing it to the public.

作为开放源代码,WordPress开发任意希望用户能够自由处理WordPress。然而,当要为竞赛或者公众消费,设计你自己的类型或者主题的时候,你就需要考虑一些问题了。这些并不是硬性规定,而是指导方针,关于怎样将你的主题设计地最好,再向公众显示。

Having the ability to quickly change a site's look is very exciting, and having your Theme or style be one of their choices is even more exciting. To keep all of this excitement going, we need to make sure that under the hood, there are some consistencies and things you should know before releasing your hard work and wonderful design to the public.

能够快速地更改站点的外观,是件令人兴奋的事情,精选你的主题或者类型更令人兴奋。我们要确定知道了一些本质内容后,在将自己的辛苦杰作和优秀的设计公之于众。

Get Familiar With the Process

熟悉这个过程

In the WordPress Codex, the main documentation for using WordPress, you will find tons of information that will answer your questions about Themes, creating Themes, styling CSS, Template Tags, and more. Before you begin the process, we recommend you get familiar with the functions of WordPress. The most comprehensive list of articles about these subjects is in the WordPress:Templates article.

WordPress Codex ,使用WordPress的主要文档,你会发现大量信息,这个信息帮助你了解关于主题,创建主题,设计CSS,模板标签,以及更多的的内容。在你开始之前,我们建议你熟悉WordPress的函数。关于这个内容的最全面的列表,在模板文章中。

Make a Plan

制作一个计划

As you consider your design possibilities, check out CSS Zen Garden for inspiration. The volunteer designers took one HTML page and created hundreds of various web page designs from it. The HTML doesn't change, only the style sheet changes. The designs are incredibly varied and unique. This shows you not only the power of designing with CSS, but also the power of the imagination to create and manipulate the most simplest of information into works of art. It begins with a plan.

但你考虑自己的设计的可行性的时候,请查看CSS Zen Garden获取灵感。志愿设计人员用一个HTML网页,创建成百上千个不同的网页设计。HTML不会更改,只是样式更改了。设计都是独特而不同的。这不仅向你显示了用CSS设计的优势,而且向你显示了将最简单的信息创建并且操作为优秀的网页的能力。这个步骤要以一个计划开始。

According to NuclearMoose, one of the popular WordPress proponents, start to make your plan with some basic tools that don't involve the computer.

根据NuclearMoose,一名受欢迎的WordPress支持者,开始用一些基本的工具,但是不包括电脑,来设计你的方案。

I have some tips...paper, pencil, sticky notes, and pencil crayons. "Whazzat for?" you ask? I'll tell you.

我拥有一些tips…纸,铅笔,粘贴的便条,和蜡笔。"Whazzat for?"你问道?我会告诉你。

I use the sticky notes to represent a piece, chunk, module, or section of the page. (Use your own appropriate term.) I write "Links" and "Navigation" etc. on them and set them on a blank piece of paper. That way, I can easily move around the elements as I like, finding something that looks balanced. I even cut some of them to size to more closely represent their actual proportion on a page.

我用粘贴的便条,代表一个网页,网页的一块,一个模块,或者一个部分。(使用适合你自己的术语。)我在这个网页块上面,编写"链接" 和 "导航",并且将这个便条粘贴到一张空白的纸张上。这样,我可以轻易地更改上面的元素,一直找到一种平衡的布局。我甚至会剪掉一些模板,这样模板会更好地在网页表现属于这个模板的内容。

After I get something I like, I will sketch it out with more detail. Often I will colour things to try out various colour combos. Actually, I just like colouring, but I don't want my kids to think I'm colouring for fun...this is serious stuff!

设计好这个部分之后,我会设计更多的详细信息。通常我会给不同的部分设置不同的颜色,一目了然。事实上,我只是喜欢加上颜色,我并不想要孩子们认为我是为了有趣,才绘制颜色的…这很重要!

I write down all of the things I want to include in the site on a piece of paper. Then I plan out each part of it, making notes about fonts, alignments, plugins that may be needed, background images, or other artwork/graphics that I may want.

我在一张纸上,写下了我希望站点上包含的所有内容。然后我设计站点的每个部分,记下字体,alignments,可能需要的插件,背景图像,或者其它我可能想要的artwork/图形。

At the end of all this process, I have a pretty good handle of how I want things to look, as well as how it should be structured. I can start gathering all of the assets for the site (images, plugins, etc.) and begin to think about coding.

In other words, there's a fair bit of non-computer-related work up front. I've found that this helps me a lot when starting the actual "construction" of the site since I'm not sitting in front of my 'puter with a blank screen in front of me, being taunted by that damn cursor blinking, blinking, blinking...

最后,我能够很好地掌握站点的外观,结构,我可以将站点的组成部分集合起来(图像,插件,等等),而且开始构思编码。

换句话说,首先有一些与电脑无关的工作。我认为这种预先工作帮了我很大的忙。当我真正开始"设计"网站的时候,我不是仅仅地坐在电脑的前面,面对这一个空白的屏面,被那个讨厌的鼠标不停地眨啊,眨的嘲弄…

Oh yeah, it doesn't hurt to have a CSS pocket reference or some other favourite CSS resource material handy so that you don't do silly things like *cough* use deprecated attributes *cough* on some of your elements.

Once you get tired of all the work, you can invite your kids to come and help Dad colour the web site and spend some quality time together.

哦,对,拥有一个CSS pocket reference 或者一些其它的极好的CSS资源材料,这样你就不会做一些蠢事,像*cough*,在你的某个部分上使用已经取消的属性*cough*。

如果你厌烦了设计这个网站,你可以邀请你的孩子们过来帮助你,设计网页的颜色,一起度过一段品质时间。

Couldn't have explained it any better. Your plan should include:

不能解释地更好了。你的方案应该包括:

  • Structural layout - Where do all the parts go?
  • 结构布局 –各个部分放到哪儿?
  • Specific Elements - Will you have a calendar, comments, what parts will you include?
  • 特别部分 –你会有日历,评论吗,你包含那些部分?
  • Template Modular Elements - Which templates will you use or add? Site map? WordPress:Pages? A distinctly different single post page?
  • 模板模块部分 –你会使用或者添加哪个模板?站点地图?网页?一个完全不同的只有一篇文章的网页?
  • Graphics - What graphics should go where?
  • 图形-什么样的图形,会放在哪里?
  • Colors - How many, how are they used, do they have a purpose or are just for show?
  • 颜色 –有多少种颜色,怎样使用这些颜色,这些颜色的使用有一个目的,还是只是为了显示?
  • Fonts - How many and what sizes go where?
  • 字体 –有多少种字体,不同的位置使用多大的字体?
  • Space - Space is an important part of layout so how will you use space?
  • 空间 –空间是布局的一个重要的部分,你会怎样使用空间?
  • Itinerary - How and when are you going to do all this?
  • Itinerary –你会在什么时候,怎样执行这些任务?

Know Your Sources

了解你的原始资源

As you design your Theme or style, you will be using HTML and CSS references. Decide to get into the code and add some PHP, you need to have the right resources to dig into and get the information right to make your WordPress website sing. We've put together a few of the resources you will need to become very familiar with over time to help you get started.

设计主题或者样式的时候,你会用到HTML和CSS reference。决定进入代码并且添加一些PHP,你需要进入正在的资源并且得到正确的信息,来构建WordPress网站。我们将你需要的一些资源集中在一起,随着时间的推移,你会渐渐地熟悉这些资源,帮助你开始建站。

Part of designing a solid WordPress Theme is to know what you are doing. This means, you have to know where to get the answers. Keep that list handy, bookmarked or saved to your hard drive. You'll refer to it often.

创建一个牢固的WordPress主题的一部分是要了解你在做什么。这指的是,你需要知道可以在那里找到答案。将列表放在手边,加入或者保存到硬盘中,你会经常查看这个列表。

Start With The Default or Classic Theme

从默认的或者经典的主题开始

You can start with someone else's theme or style sheet, that's fine, but if you really want to do this right, start with one of the two default themes that come with WordPress. They are called "Classic" and "Default" aka Kubrick.

你可以从其他人的主题或者样式表开始,但是如果你真地想要正确地执行这个步骤,从WordPress的两个默认主题开始。这两个主题是"经典的" 和"默认的" aka Kubrick。

Why start here? Because these have been through the presses by WordPress designers and testers, as well as bazillions of users who are more rigorous on these things than the developers. These are solid code, for the most part, and a good starting point. From there, do whatever your imagination desires.

为什么从这里开始?因为这是WordPress设计和测试人员以及许多比开发人员还要执着的用户所在意的过程。大多数部分是坚实的代码,是很好的起点。从这里开始,发挥想象力,做你想做的事。

Keep The Core References

保存 Core References

Do not remove "default" WordPress CSS references!

不要移除"默认" WordPress CSS references!

Okay, after making it clear that designers are free to do whatever they want as long as it validates, and that these are only guidelines and not rules, we admit it, we lied a little.

弄清楚之后,设计人员可以自动地做想做的事,只要有效即可,而且只会看到指导方针而不是规则,我们认可这一点,几乎全是真的。

User-friendly is the key to designing WordPress Themes. Part of that friendliness is to keep the default elements of code within the WordPress:Templates and WordPress:CSS files and design these to change their look, but not to remove the code references. You can hide them, but don't remove them.

用户友好性是设计WordPress主题的核心。友好的一部分是指将代码的默认元素保持在模板CSS内部,设计这些元素,更改主题的外观,但是不移除code reference。你可以隐藏code reference,但是不可以移除。

For example, in the WordPress default Theme, the Theme's author made some decisions about removing the author tag from the post (it's your blog so why would you have to keep telling people you wrote it) and the calendar. If you look at the code for the calendar, it is still there, just commented out, so if the next user wants to feature a calendar, they can. The styles for the calendar are still in the style sheet so it won't look bad if enabled.

例如,在WordPress默认主题中,主题的作者做出一些决定,将作者标签从文章(这是你的博客,那么为什么不即时地告诉他人,你写了文章呢)和日历中删除。如果你查看日历中的代码,代码还在那里,只要commented out,这样如果下一个用户想要设置日历的功能,就能够设置了。日历的样式仍然在样式表中,这样如果有日历的话,看起来也不错。

Just because you like some detail or not, leave the core coding in to accommodate the various needs of the users.

因为你喜欢一些详细信息,或者不喜欢,将核心代码保留,适应不同用户的需求。

To ensure smooth transition for language localization, use the _e() function for echoing titles and headings within the template files. This makes it easier for the translation files to hook in and translate the titles into the site's language.

确保语言本地化平稳变换,为模板文件内的echoing标题和标头使用_e()函数。这样,翻译的文件hook in,将标题翻译为站点的语言变得更加简单。

As you modify the styles, if you tread into the template files, make sure that