Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

My first word press plugin

133 views

Published on

워드프레스 플러그인 개발 개요

Published in: Internet
  • Be the first to comment

  • Be the first to like this

My first word press plugin

  1. 1. My First WordPress Plugin - 워드프레스 미트업 서울 2015 - 강동혁 2015-02-28
  2. 2. WordPress Core + Theme + Plugins
  3. 3. Hooks!
  4. 4. Hollywood Principle
  5. 5. Don’t call us, we’ll call you.
  6. 6. 지나가는 행인 역할도 좋으니 자리가 나면 연락주세요.
  7. 7. Hooking = 특정 상황에 호출될 함수를 정의
  8. 8. Filters & Actions
  9. 9. Filters add_filter(‘<filter name>’, 함수) apply_filters(‘<filter name>’, 기본값) $lower = apply_filters(‘to_lower’, ‘LOWER’); echo $lower; // lower add_filter(‘to_lower’, ‘my_to_lower’); function my_to_lower($arg) { return strtolower($arg); }
  10. 10. Actions add_action(‘<action name>’, 함수) do_action(‘<action name>’) do_action(‘print_lower’, ‘LOWER’); ---- lower add_action(‘print_lower’, ‘my_print_lower’); function my_to_lower($arg) { echo strtolower($arg); }
  11. 11. WordPress Core Plugins Themes apply_filters() do_action() Plugins Plugin Extensions Child Themes add_filter() add_action()
  12. 12. apply_filters( 'the_title' )
  13. 13. apply_filters( 'the_author' )
  14. 14. apply_filters( 'the_content' )
  15. 15. do_action( 'comment_form_before' )
  16. 16. do_action( 'twentyfourteen_credits' )
  17. 17. apply_filters( 'update_footer' )
  18. 18. Plugin Packaging /unique-plugin-name –unique-plugin-name.php –uninstall.php –/js –/css –/includes –/images
  19. 19. 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/ */ 다국어 지원
  20. 20. 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' );
  21. 21. 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>"; }
  22. 22. 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); }
  23. 23. Add Shortcode function meetup_func( $atts ) { return "<h1>안녕하세요? 워드프레스 미트업 서울 2015에 오신 것을 환영합니다.</h1>"; } add_shortcode( 'meetup', 'meetup_func’ ); 에디터에 [meetup] 입력
  24. 24. Advanced Plugins ●Activating and Deactivating Functions ●Internalization ●Nonces (Security) ●Saving and Retrieving Plugin Options ●Options Page ●Menu and Submenus ●Meta Box ●Widgets ●Custom DB Tables
  25. 25. Q & A
  26. 26. 감사합니다.

×