WordPress Core+
Theme+
Plugins
Hooks!
Hollywood Principle
Don’t call us,we’ll call you.
지나가는 행인 역할도 좋으니
자리가 나면 연락주세요.
Hooking=
특정 상황에 호출될함수를 정의
Filters & Actions
apply_filters( 'the_title' )
apply_filters( 'the_author' )
apply_filters( 'the_content' )
do_action( 'comment_form_before' )
do_action( 'twentyfourteen_credits' )
apply_filters( 'update_footer' )
Plugin Packaging
/unique-plugin-name
– unique-plugin-name.php
– uninstall.php
– /js
– /css
– /includes
– /images
Plugin Header
<?php/**
* Plugin Name: My First Plugin
* Plugin URI: http://www.mysite.com/my-first-plugin/
* Description: This is my first wordpress plugin.
* Version: 1.0.0
* Author: WordPress Meetup
* Author URI: http://www.mysite.com
* Text Domain: my-first-plugin
* Domain Path: /languages/
*/
다국어 지원
Hello Dolly
function hello_dolly_get_lyric() {
return "Some Text";
}
function hello_dolly() {
$chosen = hello_dolly_get_lyric();
echo "<p id='dolly'>$chosen</p>";
}
add_action( 'admin_notices', 'hello_dolly' );
Hello Dolly
function hello_dolly_get_lyric() {
return "Some Text";
}
function hello_dolly() {
$chosen = hello_dolly_get_lyric();
echo "<p id='dolly'>WordPress Meetup Seoul 2015</p>";
}
add_action( 'admin_notices', 'hello_dolly' );
Add Filter
function hello_dolly() {
$chosen = hello_dolly_get_lyric();
echo "<p id='dolly'>" .
apply_filters(‘dolly_lyric’, $chosen) .
"</p>";
}
function dolly_lyric_uppercase($chosen) {
return strtoupper($chosen);
}
add_filter('dolly_lyric', 'dolly_lyric_uppercase');
Add Shortcode
function meetup_func( $atts ) {
return "<h1>안녕하세요? 워드프레스 미트업 서울 2015에 오신 것을 환영합니다.</h1>";
}
add_shortcode( 'meetup', 'meetup_func' );
Advanced Plugins
● Activating and Deactivating Functions
● Internalization
● Nonces (Security)
● Saving and Retrieving Plugin Options
● Options Page
● Menu and Submenus
● Meta Box
● Widgets
● Custom Tables
감사합니다.