Upgrade to Pro — share decks privately, control downloads, hide ads and more …

俺のフックが名古屋でもこんなに簡単なわけがない。

 俺のフックが名古屋でもこんなに簡単なわけがない。

WordPressのフィルターフック、アクションフックの動作原理と使い方を実例多めに解説した資料です。

Takuro Hishikawa

August 31, 2013
Tweet

More Decks by Takuro Hishikawa

Other Decks in Technology

Transcript

  1. ໊ݹ԰
    Ͱ΋
    ԶͷϑοΫ͕͜Μͳʹ
    ؆୯ͳΘ͚͕ͳ͍ɻ
    ԶͷϑοΫ͕͜Μͳʹ
    ؆୯ͳΘ͚͕ͳ͍ɻ
    ore no hook ga konna ni kantan na wakega nai.
    8PSE'FT/BHPZB
    !)JTTZ/$
    1

    View Slide

  2. ͜Μͳઆ໌Έͨ͜ͱ͋Γ·ͤΜ͔ʁ
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ൈਮͷ>Λফ͢ʹ͸ɺGVODUJPOTQIQʹҎԼͷίʔυΛ
    ίϐʔˍϖʔετ͠·͠ΐ͏ɻ
    2

    View Slide

  3. ͜Εɺ࣮͸ʮϑοΫʯͱ͍͍·͢ɻ
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ൈਮͷ>Λফ͢ʹ͸ɺGVODUJPOTQIQʹҎԼͷίʔυΛ
    ίϐʔˍϖʔετ͠·͠ΐ͏ɻ
    3

    View Slide

  4. ϑοΫͷதͰ΋͜Ε͸ʮϑΟϧλʔϑοΫʯ
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ൈਮͷ>Λফ͢ʹ͸ɺGVODUJPOTQIQʹҎԼͷίʔυΛ
    ίϐʔˍϖʔετ͠·͠ΐ͏ɻ
    4

    View Slide

  5. ࠓ೔͸ʮϑοΫʯͷ͘͠Έʹ͍ͭͯͷ͓࿩ɻ
    5

    View Slide

  6. ϑοΫʹ͸̎ͭ͋Δɻ
    ΞΫγϣϯϑοΫ
    ϑΟϧλʔϑοΫ
    6

    View Slide

  7. 8PSE1SFTTΛྉཧͩͱ
    ߟ͑ͯΈ·͠ΐ͏
    7

    View Slide

  8. 8PSE1SFTTͷॲཧ͸
    Ϩγϐ௨Γ࡞ΒΕΔ
    ྉཧͷΑ͏ͳ΋ͷ
    8

    View Slide

  9. όλʔHΛࠞͥΔɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰࠞͥΔɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    9

    View Slide

  10. όλʔHΛࠞͥΔɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰࠞͥΔɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    શͯͷॲཧʹ͸ॱ൪͕͋Γ·͕͢ɺ
    ͦΕͧΕ͸ಠཱ͍ͯ͠·͢ɻ
    10

    View Slide

  11. όλʔHΛࠞͥΔɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰࠞͥΔɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    ༹͖ཛΛՃ͑Δɻ ॲཧΛ௥Ճ
    11

    View Slide

  12. όλʔHΛࠞͥΔɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰࠞͥΔɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    ༹͖ཛΛՃ͑Δɻ ॲཧΛ௥Ճ
    ΞΫγϣϯϑοΫ

    12

    View Slide

  13. όλʔHΛࠞͥΔɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰࠞͥΔɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    ༹͖ཛΛՃ͑Δɻ Ͳ͜ʹ௥Ճ͔ͨ͠ʁ
    13

    View Slide

  14. όλʔHΛࠞͥΔɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰࠞͥΔɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    ༹͖ཛΛՃ͑Δɻ
    ʮ;ΜΘΓ͢Δ·Ͱ
    ࠞͥͨޙʯ
    14

    View Slide

  15. ΞΫγϣϯϑοΫΛॻ͍ͯΈͨ
    function ༹͖ཛΛՃ͑Δ() {
    }
    add_action(';ΜΘΓ͢Δ·Ͱࠞͥ
    ͨޙ', '༹͖ཛΛՃ͑Δ');
    15

    View Slide

  16. ΞΫγϣϯϑοΫΛॻ͍ͯΈͨ
    function ༹͖ཛΛՃ͑Δ() {
    }
    add_action(';ΜΘΓ͢Δ·Ͱࠞͥ
    ͨޙ', '༹͖ཛΛՃ͑Δ');
    ॲཧΛ௥Ճ͢Δ
    ৔ॴΛࢦఆͯ͠ʜ
    16

    View Slide

  17. ΞΫγϣϯϑοΫΛॻ͍ͯΈͨ
    function ༹͖ཛΛՃ͑Δ() {
    }
    add_action(';ΜΘΓ͢Δ·Ͱࠞͥ
    ͨޙ', '༹͖ཛΛՃ͑Δ');
    ࣮ߦ͢ΔॲཧΛ
    ؔ਺໊Ͱࢦఆ
    17

    View Slide

  18. ΞΫγϣϯϑοΫΛॻ͍ͯΈͨ
    function ༹͖ཛΛՃ͑Δ() {
    }
    add_action(';ΜΘΓ͢Δ·Ͱࠞͥ
    ͨޙ', '༹͖ཛΛՃ͑Δ');
    ϑοΫʹՃ͑Δ
    ॲཧ͸ؔ਺ʢGVODUJPOʣͰॻ͖·͢
    18

    View Slide

  19. ͳͥ͜ΜͳΊΜͲ͍͘͞
    ͜ͱΛ͢Δͷ͔ʁ
    19

    View Slide

  20. Ϩγϐιʔείʔυ͸
    Ξοϓσʔτ͞ΕΔɻ
    ॻ͖׵͑ͯ͠·͏ͱ͋ͱ
    ͰͲ͜Λฤू͔ͨ͠Θ͔Β
    ͳ͘ͳΔɻ
    20

    View Slide

  21. ΧελϚΠζ͸ϑοΫͰߦ͏ͷ͕ݪଇɻ
    ςϯϓϨʔτʹॻ͍ͯ͠·͏ͱɺςʔϚ
    Λม͑ͨ࣌ʹॲཧ͕ফ͑ͯ͠·͏ɻ
    8FC੍࡞ऀ͸͠͹͠͹αΠτͷςʔϚ͸มΘ
    Βͳ͍΋ͷͩͱࢥ͏͕ɺҰԠಛघͳྫͰຊདྷ
    ͸Ϣʔβʔ͕ม͑Δ΋ͷ
    21

    View Slide

  22. όλʔHΛࠞͥΔɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰࠞͥΔɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    22

    View Slide

  23. όλʔHΛࠞͥΔɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰࠞͥΔɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    Ϩγϐͷதʹ͸ෳ਺ͷॲཧʹ
    ڞ௨ͨ͠ಈ࡞͕͋Γ·͢ɻ
    23

    View Slide

  24. όλʔHΛΑࠞͥ͘Δɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰΑࠞͥ͘Δɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    ʮࠞͥΔʯΛ
    ʮΑࠞͥ͘Δʯʹ
    ϑΟϧλʔΛ͔͚ͨ
    24

    View Slide

  25. όλʔHΛΑࠞͥ͘Δɻ
    ࠭౶HΛՃ͑Δɻ
    ;ΜΘΓ͢Δ·ͰΑࠞͥ͘Δɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    ʮࠞͥΔʯΛ
    ʮΑࠞͥ͘Δʯʹ
    ϑΟϧλʔΛ͔͚ͨ
    ϑΟϧλʔϑοΫ

    25

    View Slide

  26. ϑΟϧλʔϑοΫΛॻ͍ͯΈͨ
    function ࠞͥΔʹΑ͘Λ଍͢
    ($text) {
    return ‘Α͘’ . $text;
    }
    add_filter('ࠞͥΔ', 'ࠞͥΔʹ
    Α͘Λ଍͢');
    26

    View Slide

  27. όλʔHΛΑࠞͥ͘Δɻ
    ;ΜΘΓ͢Δ·ͰΑࠞͥ͘Δɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    ʮ࠭౶HΛՃ͑Δʯ
    Λॲཧ͠ͳ͍
    27

    View Slide

  28. όλʔHΛΑࠞͥ͘Δɻ
    ;ΜΘΓ͢Δ·ͰΑࠞͥ͘Δɻ
    όχϥΤοηϯεΛՃ͑Δɻ

    ʮ࠭౶HΛՃ͑Δʯ
    Λॲཧ͠ͳ͍
    ͜Ε΋ϑΟϧλʔϑοΫ

    28

    View Slide

  29. ϑΟϧλʔϑοΫΛॻ͍ͯΈͨ
    function ΍Ί͓ͯ͘() {
    return false;
    }
    add_filter('࠭౶ΛՃ͑Δ͔Ͳ͏
    ͔', '΍Ί͓ͯ͘');
    29

    View Slide

  30. ΞΫγϣϯϑοΫͷ͓͞Β͍
    function ༹͖ཛΛՃ͑Δ() {
    }
    add_action(';ΜΘΓ͢Δ·Ͱࠞͥ
    ͨޙ', '༹͖ཛΛՃ͑Δ');
    ͋͘·Ͱॲཧͷ௥Ճɻ
    30

    View Slide

  31. ϑΟϧλʔϑοΫͷ͓͞Β͍
    function ࠞͥΔʹΑ͘Λ଍͢
    ($text) {
    return ‘Α͘’ . $text;
    }
    add_filter('ࠞͥΔ', 'ࠞͥΔʹ
    Α͘Λ଍͢');
    ͋͘·Ͱطଘͷॲཧͷมߋɻ
    31

    View Slide

  32. ΞΫγϣϯϑοΫ͸جຊతʹ
    طଘͷॲཧͷมߋ͸Ͱ͖ͳ͍ɻ
    ϑΟϧλʔϑοΫ͸جຊతʹॲཧࣗମΛ
    ௥Ճ͢Δ͜ͱ͸Ͱ͖ͳ͍ɻ
    32

    View Slide

  33. ͨͩ͠ɺྫ֎ʜ
    άϩʔόϧม਺Λ࢖͑͹ΞΫγϣϯϑΟ
    ϧλʔͰ΋طଘͷॲཧͷ݁ՌΛมߋͨ͠
    ΓϑΟϧλʔ͢Δ͜ͱ͕Ͱ͖Δɻ
    άϩʔόϧม਺ςʔϚ΍ϓϥάΠϯΛ·͍ͨͰ
    8PSE1SFTTͷॲཧதͰڞ௨Ͱ࢖༻Ͱ͖Δม਺
    QPTU [email protected] [email protected]ͳͲ
    ҰԠɺม਺Λ౉ͯ͠ϑΟϧλʔͷΑ͏ʹ΋࢖͑ͯ͠·͏ʜʢ΍΍͍͜͠ʣ
    33

    View Slide

  34. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    34

    View Slide

  35. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ϑΟϧλʔϑοΫͷొ࿥
    35

    View Slide

  36. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ϑΟϧλʔΛ࣮ߦ͢Δ
    ؔ਺໊
    36

    View Slide

  37. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ϑΟϧλʔΛ࣮ߦ͢Δ
    ؔ਺
    37

    View Slide

  38. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ԿΒ͔ͷ஋Λड͚औͬͯʜ
    38

    View Slide

  39. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ۭͷจࣈྻΛฦ͍ͯ͠Δ
    39

    View Slide

  40. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ͜ͷNPSF͸
    Կʹ࢖ΘΕͯΔͷʜ
    40

    View Slide

  41. ιʔεΛಡΉ͔͠ͳ͍ʂ
    41

    View Slide

  42. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ϑοΫΛొ࿥͢Δॲཧ໊
    42

    View Slide

  43. ๯಄ͷίʔυΛ΋͏͍ͪͲݟͯΈ·͠ΐ͏
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    [email protected] [email protected]
    Ͱ8PSE1SFTTͷιʔείʔυΛݕࡧʂ
    43

    View Slide

  44. 8PSE1SFTTίΞϑΝΠϧͷ֘౰ͷίʔυ
    function wp_trim_excerpt($text = '') {
    $raw_excerpt = $text;
    if ( '' == $text ) {
    $text = get_the_content('');
    $text = strip_shortcodes( $text );
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $excerpt_length = apply_filters('excerpt_length', 55);
    $excerpt_more = apply_filters('excerpt_more', ' ' .
    '[...]');
    $text = wp_trim_words( $text, $excerpt_length,
    $excerpt_more );
    }
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }
    wp-includes/formatting.phpʢൈਮʣ
    44

    View Slide

  45. 8PSE1SFTTίΞϑΝΠϧͷ֘౰ͷίʔυ
    function wp_trim_excerpt($text = '') {
    $raw_excerpt = $text;
    if ( '' == $text ) {
    $text = get_the_content('');
    $text = strip_shortcodes( $text );
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $excerpt_length = apply_filters('excerpt_length', 55);
    $excerpt_more = apply_filters('excerpt_more', ' ' .
    '[...]');
    $text = wp_trim_words( $text, $excerpt_length,
    $excerpt_more );
    }
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }
    [email protected]
    ϑΟϧλʔΛ͔͚Δ
    wp-includes/formatting.phpʢൈਮʣ
    45

    View Slide

  46. 8PSE1SFTTίΞϑΝΠϧͷ֘౰ͷίʔυ
    function wp_trim_excerpt($text = '') {
    $raw_excerpt = $text;
    if ( '' == $text ) {
    $text = get_the_content('');
    $text = strip_shortcodes( $text );
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $excerpt_length = apply_filters('excerpt_length', 55);
    $excerpt_more = apply_filters('excerpt_more', ' ' .
    '[...]');
    $text = wp_trim_words( $text, $excerpt_length,
    $excerpt_more );
    }
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }
    ઌ΄ͲͷNPSFͷத਎͕൑໌ɻ
    ൒֯εϖʔε>ͩͬͨɻ
    wp-includes/formatting.phpʢൈਮʣ
    46

    View Slide

  47. ๯಄ͷίʔυʹ໭͖ͬͯ·ͨ͠
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ͭ·Γ͜ͷNPSF͸
    bbb>`ͱ͍͏จࣈྻͰͨ͠
    47

    View Slide

  48. ๯಄ͷίʔυʹ໭͖ͬͯ·ͨ͠
    function new_excerpt_more($more) {
    return '';
    }
    add_filter('excerpt_more',
    'new_excerpt_more');
    ϑΟϧλʔϑοΫΛ࢖ͬͯ
    ۭͷจࣈྻΛฦ͢͜ͱͰʜ
    48

    View Slide

  49. 8PSE1SFTTίΞϑΝΠϧͷ֘౰ͷίʔυ
    function wp_trim_excerpt($text = '') {
    $raw_excerpt = $text;
    if ( '' == $text ) {
    $text = get_the_content('');
    $text = strip_shortcodes( $text );
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $excerpt_length = apply_filters('excerpt_length', 55);
    $excerpt_more = apply_filters('excerpt_more', ' ' .
    '[...]');
    $text = wp_trim_words( $text, $excerpt_length,
    $excerpt_more );
    }
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }
    ίΞϑΝΠϧதͷ[email protected]ʹ
    ୅ೖ͞ΕΔ஋͕มΘΔ
    wp-includes/formatting.phpʢൈਮʣ
    49

    View Slide

  50. ʜʜ෇͍͖ͯͯΔ͔ʔͬʂʁ
    50

    View Slide

  51. Ͱ͸͞Βʹ࣮ફฤɻ
    51

    View Slide

  52. 8PSE1SFTTͷΧςΰϦʔ΢ΟδΣοτ
    ฒͼॱΛม͍͑ͨͳ͊ʜ
    52

    View Slide

  53. ฒͼॱͷઃఆ͕ͳ͍ʜ
    53

    View Slide

  54. ͯ͜͜͞Ͱ࣭໰ɻ
    ΧςΰϦʔ΢ΟδΣοτ͕දࣔ͢Δ
    ΧςΰϦʔͷฒͼॱΛม͍͑ͨɻ
    ͜Ε͸ΞΫγϣϯϑοΫʁ
    ϑΟϧλʔϑοΫʁ
    54

    View Slide

  55. ֘౰෦෼ͷίʔυ
    /**
    * Categories widget class
    *
    * @since 2.8.0
    */
    class WP_Widget_Categories extends WP_Widget {
    ...
    ! ! $cat_args = array('orderby' => 'name', 'show_count' => $c,
    'hierarchical' => $h);
    ...
    ! !
    ! ! $cat_args['title_li'] = '';
    ! ! wp_list_categories(apply_filters('widget_categories_args',
    $cat_args));
    ?>
    ! !
    ...
    wp-includes/default-widget.phpʢൈਮʣ
    55

    View Slide

  56. ֘౰෦෼ͷίʔυ
    /**
    * Categories widget class
    *
    * @since 2.8.0
    */
    class WP_Widget_Categories extends WP_Widget {
    ...
    ! ! $cat_args = array('orderby' => 'name', 'show_count' => $c,
    'hierarchical' => $h);
    ...
    ! !
    ! ! $cat_args['title_li'] = '';
    ! ! wp_list_categories(apply_filters('widget_categories_args',
    $cat_args));
    ?>
    ! !
    ...
    [email protected]@DBUFHPSJFT
    ؔ਺Ͱ
    ΧςΰϦʔͷҰཡΛग़ྗͯ͠ΔΑ͏ͩɻ
    wp-includes/default-widget.phpʢൈਮʣ
    56

    View Slide

  57. ֘౰෦෼ͷίʔυ
    /**
    * Categories widget class
    *
    * @since 2.8.0
    */
    class WP_Widget_Categories extends WP_Widget {
    ...
    ! ! $cat_args = array('orderby' => 'name', 'show_count' => $c,
    'hierarchical' => $h);
    ...
    ! !
    ! ! $cat_args['title_li'] = '';
    ! ! wp_list_categories(apply_filters('widget_categories_args',
    $cat_args));
    ?>
    ! !
    ...
    Φϓγϣϯ஋[email protected]ʹ
    ϑΟϧλʔΛ௨ͯ͋͠Δʂ
    ͜ΕͰฒͼॱ΋มߋͰ͖ͦ͏ɻ
    wp-includes/default-widget.phpʢൈਮʣ
    57

    View Slide

  58. ֘౰෦෼ͷίʔυ
    /**
    * Categories widget class
    *
    * @since 2.8.0
    */
    class WP_Widget_Categories extends WP_Widget {
    ...
    ! ! $cat_args = array('orderby' => 'name', 'show_count' => $c,
    'hierarchical' => $h);
    ...
    ! !
    ! ! $cat_args['title_li'] = '';
    ! ! wp_list_categories(apply_filters('widget_categories_args',
    $cat_args));
    ?>
    ! !
    ...
    Φϓγϣϯ஋[email protected]͸
    ഑ྻͳΜͩͳɻ
    ฒͼॱ͸໊લॱʹͳ͍ͬͯΔͳɻ
    wp-includes/default-widget.phpʢൈਮʣ
    58

    View Slide

  59. ֘౰෦෼ͷίʔυ
    /**
    * Categories widget class
    *
    * @since 2.8.0
    */
    class WP_Widget_Categories extends WP_Widget {
    ...
    ! ! $cat_args = array('orderby' => 'name', 'show_count' => $c,
    'hierarchical' => $h);
    ...
    ! !
    ! ! $cat_args['title_li'] = '';
    ! ! wp_list_categories(apply_filters('widget_categories_args',
    $cat_args));
    ?>
    ! !
    ...
    ϑΟϧλʔ໊͸
    ʮ[email protected]@BSHTʯ͔ɻ
    wp-includes/default-widget.phpʢൈਮʣ
    59

    View Slide

  60. GVODUJPOTQIQʹهࡌ͢Δίʔυ
    function change_widget_category_orderby( $cat_args )
    {
    $cat_args['orderby'] = 'count';
    $cat_args['order'] = 'DESC';
    return $cat_args;
    }
    add_filter( 'widget_categories_args',
    'change_widget_category_orderby' );
    60

    View Slide

  61. GVODUJPOTQIQʹهࡌ͢Δίʔυ
    function change_widget_category_orderby( $cat_args )
    {
    $cat_args['orderby'] = 'count';
    $cat_args['order'] = 'DESC';
    return $cat_args;
    }
    add_filter( 'widget_categories_args',
    'change_widget_category_orderby' );
    [email protected]@DBUFHPSJFT
    ͷ
    Φϓγϣϯ஋Λ഑ྻͰड͚औͬͯʜ
    ˢ
    ͜Ε͕ιʔεΛಡ·ͳ͍ͱ෼͔Βͳ͍
    61

    View Slide

  62. GVODUJPOTQIQʹهࡌ͢Δίʔυ
    function change_widget_category_orderby( $cat_args )
    {
    $cat_args['orderby'] = 'count';
    $cat_args['order'] = 'DESC';
    return $cat_args;
    }
    add_filter( 'widget_categories_args',
    'change_widget_category_orderby' );
    มߋ͍ͨ͠Φϓγϣϯ஋Λ
    ઃఆͯ͠ʜ
    ˢ
    ͬͪ͜͸$PEFYͷ[email protected]@DBUFHPSJFTͷ
    ϖʔδΛݟͳ͍ͱ෼͔Βͳ͍
    62

    View Slide

  63. GVODUJPOTQIQʹهࡌ͢Δίʔυ
    function change_widget_category_orderby( $cat_args )
    {
    $cat_args['orderby'] = 'count';
    $cat_args['order'] = 'DESC';
    return $cat_args;
    }
    add_filter( 'widget_categories_args',
    'change_widget_category_orderby' );
    ฦ͢
    63

    View Slide

  64. Ͱ͖ͨʂ
    ΧςΰϦʔͷ
    ౤ߘ਺ॱ

    ߱ॱ
    64

    View Slide

  65. ͜ͷΑ͏ʹɺϑΟϧλʔϑοΫ͸
    ϑΟϧλʔ͞ΕΔ஋͕ͲΜͳ஋Ͱ
    ϑΟϧλʔϑοΫͰฦͨ͠஋͕
    ͦͷޙͲͷΑ͏ʹ࢖ΘΕΔͷ͔͸ɺ
    ϑοΫʹΑͬͯҟͳΔ͠ɺ
    ιʔεΛݟͳ͍ͱ෼͔Βͳ͍ɻ
    65

    View Slide

  66. ͞ΒʹɺΞΫγϣϯϑοΫ͸
    8PSE1SFTT͕ͲΜͳॱ൪Ͱ
    ԿΛॲཧ͍ͯ͠Δͷ͔ɺ
    ͋Δఔ౓Θ͔ͬͯͳ͍ͱ
    Ͳ͜ʹϑοΫ͍͍ͯ͠ͷ͔
    ෼͔Βͳ͍ɻ
    66

    View Slide

  67. ͑ʁ݁ہ
    ೉͍͠͡Όͳ͍͔ͬͯʜʁ
    ?
    67

    View Slide

  68. ԶͷϑοΫ
    ͕ͦΜͳʹ
    ؆୯ͳΘ͚͕ͳ͍ʂ
    ԶͷϑοΫ
    ͕ͦΜͳʹ
    ؆୯ͳΘ͚͕ͳ͍ʂ
    68

    View Slide

  69. ϑΟϧλʔϑοΫͷσόοάʹ͸
    %FCVH#BS&YUFOEFSϓϥάΠϯͷ
    7BSJBCMF-PPLVQػೳ͕ศར
    IUUQXPSEQSFTTPSHFYUFOEQMVHJOTEFCVHCBSFYUFOEFS
    Ͱ΋
    ΞΫγϣϯϑοΫͱϑΟϧλʔϑοΫͷ
    ҧ͍ɺجຊతͳߟ͑ํΛ஌͓͚ͬͯ͹
    ͦΜͳʹා͘ͳ͍Αʂ
    69

    View Slide

  70. Ͱ͸࠷ޙʹ࿅श໰୊ɻ
    70

    View Slide

  71. XQMPHJOQIQΛΧελϚΠζͯ͠ΈΑ͏
    XQMPHJOQIQ͸ϩάΠϯը໘
    ݟͨ໨ΛΧελϚΠζͰ͖Δ֤छͷ
    ΞΫγϣϯˍϑΟϧλʔϑοΫ͕͋Δ
    ͙͢ʹ֬ೝͰ͖Δ͠Өڹൣғ΋গͳ͍ͷ
    Ͱ࿅श޲͖
    71

    View Slide

  72. XQMPHJOQIQͷϑΟϧλʔϑοΫ
    $login_header_url = __( 'http://wordpress.org/' );
    ...
    $login_header_url =
    apply_filters( 'login_headerurl',
    $login_header_url );
    ...
    bloginfo( 'name' ); ?>
    wp-login.phpʢൈਮʣ
    72

    View Slide

  73. XQMPHJOQIQͷϑΟϧλʔϑοΫ
    $login_header_url = __( 'http://wordpress.org/' );
    ...
    $login_header_url =
    apply_filters( 'login_headerurl',
    $login_header_url );
    ...
    bloginfo( 'name' ); ?>
    wp-login.phpʢൈਮʣ
    ม਺[email protected]@VSMʹ͸
    8PSE1SFTTެࣜαΠτͷ63-͕
    ֨ೲ͞Ε͍ͯΔ
    ʢ຋༁ϑΝΠϧʹΑ࣮ͬͯࡍʹ͸
    KBXPSEQSFTTPSHʹͳΔʣ
    73

    View Slide

  74. XQMPHJOQIQͷϑΟϧλʔϑοΫ
    $login_header_url = __( 'http://wordpress.org/' );
    ...
    $login_header_url =
    apply_filters( 'login_headerurl',
    $login_header_url );
    ...
    bloginfo( 'name' ); ?>
    wp-login.phpʢൈਮʣ
    ม਺[email protected]@VSMʹ
    ϑΟϧλʔ͕ద༻͞Ε͍ͯΔ
    74

    View Slide

  75. XQMPHJOQIQͷϑΟϧλʔϑοΫ
    $login_header_url = __( 'http://wordpress.org/' );
    ...
    $login_header_url =
    apply_filters( 'login_headerurl',
    $login_header_url );
    ...
    bloginfo( 'name' ); ?>
    wp-login.phpʢൈਮʣ
    ม਺[email protected]@VSM͕
    ࢖ΘΕ͍ͯΔͷ͸ϩάΠϯ
    ϑΥʔϜͷϩΰͷϦϯΫઌ
    75

    View Slide

  76. GVODUJPOTQIQ͔ΒϦϯΫઌΛม͑ͯΈΑ͏
    function change_login_headerurl( $login_headerurl )
    {
    ! return 'http://2013.wordfes.org/';
    }
    add_filter( 'login_headerurl',
    'change_login_headerurl' );
    76

    View Slide

  77. XQMPHJOQIQͷΞΫγϣϯϑοΫ

    wp-login.phpʢൈਮʣ
    ΞΫγϣϯϑοΫ͕࣮ߦ͞ΕΔͷ͸
    [email protected]ؔ਺
    ॲཧͷʮ௥ՃʯͳͷͰɺ
    طଘͷ஋Λ࢖͏͜ͱ΋ͳ͘
    γϯϓϧͰ͢Ͷɻ
    77

    View Slide

  78. XQMPHJOQIQͷΞΫγϣϯϑοΫ
    function login_footer_message() {
    ! echo 'ͭͳ͕Ζ·͍ʂ';
    }
    add_action( 'login_footer',
    'login_footer_message' );
    ϝοηʔδΛ௥Ճͯ͠Έͨ
    78

    View Slide

  79. ࿅श໰୊ɿϩάΠϯΤϥʔϝοηʔδ
    echo '' .
    apply_filters('login_errors', $errors) . "\n";
    wp-login.phpʢൈਮʣ
    ΤϥʔϝοηʔδͷʮɻʯΛ
    ʮὑʯʹม͑ͯΈ·͠ΐ͏ʂ
    ղ౴͸ͪ͜Β
    IUUQTHJTUHJUIVCDPNIJTTZ
    DGCB
    79

    View Slide

  80. ϑοΫ͕ා͘ͳ͘ͳ͔ͬͨͳʁʁ
    80

    View Slide

  81. ϑοΫʹؔ͢ΔϒϩάΛ৭ʑΞοϓͯ͠·͢ɻ
    ϑΟϧλʔϑοΫɿΧελϜϝχϡʔͷ߲໨ʹ෇༩͞ΕΔΫϥεΛΧελϚΠζ͢Δ
    IUUQOPUOJMDSFBUJWFDPNCMPHBSDIJWFT
    ϑΟϧλʔϑοΫɿݕࡧ݁ՌͰ౤ߘλΠϓ͝ͱʹҧ͏ςϯϓϨʔτϑΝΠϧΛ࢖͏
    IUUQOPUOJMDSFBUJWFDPNCMPHBSDIJWFT
    ΞΫγϣϯϑοΫɿςʔϚ͔Β+BWBTDSJQU΍$44ΛಡΈࠐΉॻ͖ํ·ͱΊ
    IUUQOPUOJMDSFBUJWFDPNCMPHBSDIJWFT
    ΞΫγϣϯϑοΫɿπʔϧόʔΛΧελϚΠζ͢Δ
    IUUQOPUOJMDSFBUJWFDPNCMPHBSDIJWFT
    ΞΫγϣϯϑοΫɿύϯͣ͘φϏήʔγϣϯʢ#SFBEDSVNC/BW95ʣΛΧελϚΠζ͢Δ
    IUUQOPUOJMDSFBUJWFDPNCMPHBSDIJWFT
    ϑΟϧλʔϑοΫɿΪϟϥϦʔΛΧελϚΠζͯ͠޷͖ͳK2VFSZϓϥάΠϯΛ࢖͏
    IUUQOPUOJMDSFBUJWFDPNCMPHBSDIJWFT
    81

    View Slide

  82. 5IBOLT
    82

    View Slide