可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
What are the best resources for Wordpress theme-development? I am currently in the phase of starting my own blog, and don't want to use one of the many free themes. I already have a theme for my website, so I want to read about best-practices.
Any advice on how to get started would be very welcome :)
I have now created my theme (wohoo!), and thought I should summarize the best resources I found. Lets see..
Resources:
- ThemeTation's three-part guide to create a wordpress-theme from scratch
- Nettuts.com's guide: How to Create a Wordpress Theme from Scratch
Didn't actually use this, it's a quite new article, but anyway - it's great. It will get a follow-up in the next few days too..
- Wordpress.org's own guide on templates
Definatly a must-read for everyone new to wordpress-designing..
- "The loop"
Essential knowledge, also a must-read
- Directory of all the template tags
Used by wordpress to actually output blog-content..
Inspiration:
- Smashing Magazine's lists: first, one more, yet another one
- Wordpress.org's theme-directory
回答1:
I think that the best way to learn is to look at how other people construct their themes. The first one to start one is the Default Kubrick theme that is included in the standard WordPress install. It has all of the basics and will show you some advanced techniques like including sidebar widgets. Next, in conjunction with the docs on theme development (previously mentioned by Mark), Blog Design and Layout and Using Themes, go to the Theme Directory on the Wordpress.org site, download a couple of popular themes, and go through them, looking up any template tags or techniques that you don't understand. After you do this, you should be more than well-equipped to write your own theme from scratch, or modify an existing theme to your needs.
回答2:
The Wordpress part is the easy bit. That's basically taking your static HTML pages then converting them to PHP and inserting the Wordpress tags to pull content from the database. In some places these tags will be in a loop, e.g. for a list of pages.
The most difficult part is the design. You should identify the page types you want (e.g. main page, lists of posts, static pages, about) and create the actual templates with mockup text. ONly when you're happy should you think about the Wordpress part.
If you search with Google you'll find plenty of pages on creating your own Wordpress theme or converting HTML to a theme.
回答3:
Here's another good article on the topic. And of course, there are many more like it. I have reviewed this particular article in the past though, and found it to be a good, detailed tutorial with some nice external references where required.
回答4:
回答5:
Here's the WordPress doc on Theme Development
回答6:
I've found this illustration shared by Yoast to be really helpful for explaining how a Wordpress theme is built:
Full image here
This is a crop of the full image - I'd suggest checking it the full page there, as it's extremely clear, and very well thought out.
回答7:
Here is a "starter kit" of sorts that may be of use to you:
http://wpthemerkit.com/
回答8:
Found a new one over here. it's a good resource if you want to make a simple theme. :)
http://www.webhostingsearch.com/articles/create-your-own-wordpress-theme-tutorial.php
回答9:
check css-tricks.com Chris has a few screencasts up.
回答10:
There is a really good book on WordPress Theme Design, called "WordPress Theme Design" :)
Available from Amazon and other book stores.
回答11:
'Starkers' is a great blank WordPress theme to start any theme development.
http://elliotjaystocks.com/blog/2008/free-starkers-wordpress-theme/
回答12:
This WordPress Meta Box PHP Helper class might help you when working with WordPress Meta Boxes.