Posts

Showing posts from January, 2014

HTML5DevConf: Kruger, Marcus, "Launching Goo Create - WebGL graphics made easy"

Goo Engine and Goo Create http://www.gootechnologies.com/

Write your own WordPress plugin

Image
我將介紹如何撰寫一個JQuery的WordPress plugin 首先在%WordPressRoot%/wp-content/plugins下建立一個你plugin名稱的資料夾,這個名稱儘量獨特一點,避免之後跟WordPress plugin store上的套件撞名,ex: ellis123456.接著再產生一個跟資料夾名稱一樣的php檔案,ellis123456.php. 首先加上描述,說明版本與作者資訊.此定義內容會存在WordPress的plugin簡介,請勿務必填寫完整 /** * Plugin Name: ellisJQuery * Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates * Description: Ellis's specific version of JQuery for WordPress. * Version: 0.0.003 * Author: Ellis Mu * Author URI: http://URI_Of_The_Plugin_Author * License: GPL2 */ 定義plugin的unique id以及需要多國語言時它的目錄 load_plugin_textdomain('ellis123456', false, basename( dirname( __FILE__ ) ) . '/languages' ); 定義完成後,我們就可以開始載入JQuery函式庫, function initJQuery() { wp_register_style( 'jquery', plugins_url('style/eggplant/jquery-ui-1.10.4.custom.min.css', __FILE__) ); wp_enqueue_style( 'jquery' ); /* * We should load jquery before load jquery ui. */ wp_register_script( 'jquery', 

Using MAMP to install WordPress

Image
MAMP是一個可以在Mac本機上直接安裝設定Apache, MySQL, PHP的好用軟體.(Windows版本為WAMP). 1. 他十分簡單,首先去MAMP下載安裝檔( http://www.mamp.info/en/index.html ).他有分為一般版本及Pro版,Pro版需要付錢,因此我們使用一般版本來說明. 安裝完後的界面如下: 安裝完成後,使用瀏覽器觀看我們的首頁會在port:8888 2. 接下來我們要安裝WordPress 在安裝WordPress之前記得要先設定一組db帳號在MySQL,設定步驟如下: 在Terminal視窗輸入:/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot ( http://documentation.mamp.info/en/mamp/how-tos/using-mysql-command-line ) 接著觀察目前的db---  show databases; 創建一組新的db--- CREATE DATABASE wordpress; 創建你的使用者帳號--- CREATE USER ellis@localhost; 建立使用者密碼--- SET PASSWORD FOR ellis@localhost= PASSWORD("xxxxxxxxx"); 綁定帳號與db--- GRANT ALL PRIVILEGES ON wordpress.* TO ellis@localhost IDENTIFIED BY 'xxxxxxxxx'; 刷新 FLUSH PRIVILEGES; 離開 exit 3. 最後我們就可以安裝我們的WordPress了 去WordPress首頁下載zip檔( http://wordpress.org/download/ ).解壓縮後丟到/Applications/MAMP/htdocs/,接著在瀏覽器執行http://localhost:8888/wordpress/就會進入我們的設定頁 最後你的WordPress在Mac本機端的架設就完成了~~~