Wordpress 主题开发快速入门 [英] Wordpress Theme Development Quick Start

查看:31
本文介绍了Wordpress 主题开发快速入门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图寻找一个快速而肮脏的 wordpress 主题开发入门教程.现在我知道如何自己去发现东西了,我在开始 wordpress 开发时正在寻找程序员的十大常见问题解答".(例如,打开调试以及调试选项所在的位置),如何最好地设置您的开发环境.

I tried looking for a quick and dirty getting started with wordpress theme development tutorial. Now I know how to go and discover things myself, I'm looking for "top ten FAQ for programmers" when starting wordpress development. (For example, Turn on debugging and where the debugging option is located), how best to setup your dev environment.

我所能找到的只是详尽的或太低级或太高级的指南.来自创建自定义 wordpress 类应用程序的背景让我感到沮丧.

All I can find is elaborate or too low level or too high level guides to it. Coming from a background of creating custom wordpress-like applications makes me frustrated.

所以也许有人可以列出我需要的一些东西.我不需要知道 wordpress 是如何工作的,什么是数据库、小部件或页面.

So perhaps someone can list of the few things I need. I don't need to know how wordpress works, what a database or widget or page is.

我专门搜索的问题:1. 如何让 wordpress 从我的 IDE 监视主题文件夹中的更改(我真的不敢相信有人会通过 wordpress 管理主题编辑器开发......没有撤消历史!).在我重新安装主题之前,更改文件似乎不会生效.调试模式需要为true吗?

Question I was specifically searching for: 1. How do I make wordpress watch the theme folder for changes from my IDE ( I can't really believe anybody would develop through the wordpress admin theme editor...No Undo history!). Changing the files doesn't seem to take affect until I re-install the theme. Debug mode needs to be true?

  1. 任何链接的精简版:http://codex.wordpress.org/Theme_Development 或类似内容?
  1. Any links condensed version of this: http://codex.wordpress.org/Theme_Development or similar?

推荐答案

WordPress 使用文件层次结构来确定最终显示给用户的内容.对于初学者来说,创建 WordPress 主题所需的只是一个 style.cssindex.php.

WordPress use a hierarchy of files to determine what ends up being shown to the user. For starters all you need to create a WordPress theme is a style.css and index.php.

这是您必须在 style.css 中放入的内容,以使其成为有效的 WordPress 主题:

This is what you will have to put in your style.css in order to make it a valid WordPress theme:

/*
Theme Name: Your theme name
Theme URI: http://www.example.com/
Description: Describe your theme.
Author: Your name or company
Author URI: http://www.example.com/
Version: 1.0
Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional)

License:
License URI:

General comments (optional).
*/

您真正需要添加的只是主题的唯一名称,WordPress 会识别它并将其列在您的其他主题中.即使这样可行,我还是建议您提供尽可能多的信息.

All you really need to include is a unique name for your theme and WordPress will recognize it and list it among your other themes. Even though that works, I would recommend including as much info as possible.

只要有两个文件,index.php 就会为每个页面视图运行,而不管用户要求的内容类型.您可以通过添加诸如 page.php 之类的文件来扩展它以显示所有页面,添加single.php 以不同方式显示单个帖子等等.

With just two files, index.php will then run for every single page view, no matter the type of content the user asks for. You can extend this by adding files like page.php to display all your pages, single.php to display single posts differently and so on.

我强烈建议您熟悉 WordPress Codex.这是一个很好的起点:http://codex.wordpress.org/Template_Hierarchy

I highly recommend getting familiar with the WordPress Codex. This is a good place to start: http://codex.wordpress.org/Template_Hierarchy

下图解释了层次结构以及最终提供的文件.我有时会参考它,没有必要完全记住它.

The image below explains the hierarchy and what file ends up being served. I use it sometimes for reference, there is no need to memorize it entirely.

这篇关于Wordpress 主题开发快速入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆