九月24

製作 WordPress Theme 需注意的事項

之前上傳到 themes.wordpress.net 的作品因為 wordpress 官網改版的關係,很多 theme 都流失了,剛剛在整理之前設計的四款佈景時,整理完畢要上傳到官方網站,發現在 2.5 版之後多了許多修正的部分。

CSS 設定

必須在佈景主題的 CSS 內加上必要的 CSS 設定

Starting with WordPress 2.5 there are alignment CSS classes that are used by the visual editor. In order for images to be shown correctly themes are required to have these classes. Please add these classes to your style.css file and then upload the zip file again. Additional details are available at http://codex.wordpress.org/CSS.

所以要在 CSS 裡面加上

.aligncenter {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.alignleft {
	float: left;
}

.alignright {
	float: right;
}

以及

.wp-caption {
	border: 1px solid #ddd;
	text-align: center;
	background-color: #f3f3f3;
	padding-top: 4px;
	margin: 10px;
	-moz-border-radius: 3px;
	-khtml-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}

.wp-caption img {
	margin: 0;
	padding: 0;
	border: 0 none;
}

.wp-caption-dd {
	font-size: 11px;
	line-height: 17px;
	padding: 0 4px 5px;
	margin: 0;
}

另外要在 CSS 開頭的部分加上佈景主題的 Tag
這部分可以參考 2.6.2 版本 Default 裡的 style.css
Tags: blue, custom header, fixed width, two columns, widgets
Tag 的內容可以自己修改,主要是幫 theme 加上 tag 方便使用者搜尋

還有作者的 URI 以及 佈景的 URI 不能為同一個網址

此部分為 CSS 撰寫時要注意的地方

Single.php 設定
自從 2.3 版本之後 WordPress 有了內建的 Tag 功能,造成其他開發出來的 tag plugin 都相形失色,這是必須在 Single.php 內加上

Tags: ‘, ‘, ‘, ‘

‘); ?>

還有 @@ (OOXX ,規定一堆)

Comments.php 設定
除了 Tag 之外還要替 comments.php 加上 gravatar 為什麼了? 因為 Automattic公司在去年 2007/10/18 購併gravatar (via),為了要凸顯自家產品的特色,所以要在 comments.php 裡面加上

如此一來之前舊的佈景主題才能夠上傳到 WordPress 的官方網站,當然不是上傳就馬上可以被認可,還要經過認證。所以如果您是喜歡設計 WordPress 佈景主題的愛好者,就要注意一下囉!
so …….. 一大堆規定,改的真累 ˊ ˋ 。

PS: 目前之前設計的四款佈景主題已經上傳了,等待確認中,希望可以通過。

  • IE真是有夠濫! 轉換跑道! - 10/14/2004
  • wpzipper - wordpress + plugin 打包服務 - 05/21/2007
  • 墾丁之旅 - 09/09/2004
  • Gmail 放送(3個名額) - 09/11/2004
  • 墾丁之旅-照片與行程分享 - 09/13/2004
  • Theme - Hyaline 1.1 & Drop2Splash 1.1 - 05/11/2007
  • 在臺灣,何謂R&D工程師? - 08/27/2007
  • 關於昨天被惡意更改固定網址 - 01/20/2007
  • 雪隧大客車15日上路囉~ - 11/02/2007
  • 送Gmail(六名) - 09/19/2004
  • 2 篇留言 在 “製作 WordPress Theme 需注意的事項”
    1. 阿源 Says:

      艾德 辛苦了
      沒想到現在要把Theme上傳至WP官方網站
      還多了那麼多的規定

    2. Eduardo Says:

      還好啦,Hyaline 已經通過官方認可,其他的慢慢改。

    留言灌水一下吧!