$30 off During Our Annual Pro Sale. View Details »

MW WP Form について語り尽くす

MW WP Form について語り尽くす

WordBench Fest.山口 -Spring WP Fever- 2017/05/20

Takashi Kitajima

May 21, 2017
Tweet

More Decks by Takashi Kitajima

Other Decks in Technology

Transcript

  1. .881'PSNʹ͍ͭͯޠΓਚ͘͢ 8PSE#FODI'FTUࢁޱ4QSJOH81'FWFS

  2. ϞϯΩʔϨϯν IUUQTJODPSH 
 ΩλδϚλΧγ !JOD   ϑϦʔϥϯε
 8FCσβΠφʔϓϩάϥϚʔ 

    8PSE1SFTTϓϥάΠϯ
 .881'PSNɺ4NBSU$VTUPN'JFMET  8PSE1SFTTςʔϚ
 )BCBLJSJɺ.JNJ[VLV  4BTT$44ϑϨʔϜϫʔΫ
 #BTJT
  3. 8PSE1SFTTίϛϡχςΟͱͷؔΘΓ  8PSE$BNQ5PLZP࣮ߦҕһ  8PSE$BNQ5PLZP-5  8PSE$BNQ,BOTBJ࣮ߦҕһϋϯζΦϯ  8PSE$BNQ,BOTBJ࣮ߦҕһεϐʔΧʔ 

    8PSE$BNQ5PLZPεϐʔΧʔ  FUD
  4. ຊ౰ʹ࢖͑ΔςʔϚͱ͸ͲͷΑ͏ͳ ΋ͷ͔Λߟ͑ଓ͚ͨ݁Ռ ΩλδϚλΧγ!JOD IUUQTHJUIVCDPNJODNJNJ[VLV

  5. .881'PSNͱ͸

  6. .881'PSNͱ͸ w ͓໰͍߹ΘͤϑΥʔϜ࡞੒ϓϥάΠϯ w ֬ೝը໘Λ͸͞Ή͜ͱ͕Ͱ͖Δ w μ΢ϯϩʔυ਺ɿ   w

    ΞΫςΟϒΠϯετʔϧ਺ɿ 
  7. $POUBDU'PSN w μ΢ϯϩʔυ਺ɿ    w ΞΫςΟϒΠϯετʔϧ਺ɿ  

  8. https://nondesu.jp/

  9. IUUQTXQEPSH

  10. IUUQTXQEPSH

  11. .881'PSNͷجຊػೳ

  12.  ೖྗը໘c֬ೝը໘c׬ྃը໘  63-ͷઃఆ  ໰͍߹Θͤͷσʔλϕʔεอଘ  ໰͍߹Θͤσʔλͷάϥϑදࣔ  ๛෋ͳόϦσʔγϣϯϧʔϧ

  13. .881'PSNͷ࣮ߦϓϩηε

  14.  ຋༁ϑΝΠϧͷಡΈࠐΈ  ֤ೖྗϑΟʔϧυͷಡΈࠐΈ  ֤όϦσʔγϣϯϧʔϧͷಡΈࠐΈ  .881'PSNΛ؅ཧ͢ΔΧελϜ౤ߘλΠϓΛొ࿥  ϝΠϯίϯτϩʔϥʔಡΈࠐΈ

     ςϯϓϨʔτͷಡΈࠐΈ௚લ UFNQMBUF@JODMVEF   ౤ߘσʔλɾςϯϓϨʔτ಺ʹ.881'PSNΛ࣮ߦ͢ΔͨΊͷγϣʔτίʔυ
 <NXGPSN@GPSNLFZ>ɺ<NXGPSN> ͕ଘࡏ͢Δ͔νΣοΫ  ଘࡏ͠ͳ͔ͬͨΒ͜͜Ͱ.881'PSNʹؔ͢Δॲཧ͸ऴྃ  γϣʔτίʔυΛ΋ͱʹͦͷϑΥʔϜͷઃఆΛऔಘ  ૹ৴σʔλΛ%#ʹҰ࣌తʹอଘ 5SBOTJFOU"1* $PPLJF   ϖʔδΩϟογϡΛແޮʹ͢ΔͨΊͷ)551ϔομʔΛग़ྗ  ૹ৴σʔλ͕ਖ਼͍͔͠νΣοΫ  $43'ରࡦͱͯ͠ૹ৴σʔλʹؚ·ΕΔτʔΫϯΛνΣοΫ  ૹ৴σʔλʹର͠όϦσʔγϣϯνΣοΫΛ࣮ߦ  ૹ৴σʔλɺόϦσʔγϣϯ݁ՌΛݩʹͲͷը໘Λදࣔ ϦμΠϨΫτ ͢Δ͔Λܾఆ  1045࣌ɺ΋͘͠͸ϦμΠϨΫτઌ͕ݱࡏͷ63-ͱҟͳΕ͹ϦμΠϨΫτΛ࣮ߦ ॳظԽɾجຊॲཧ ը໘දࣔͷͨͼʹ࣮ߦ Wݱࡏ
  15.  લड़ͷॳظԽॲཧΛ࣮ߦ  ࠷ॳʹදࣔ͢Δ΂͖ը໘ೖྗը໘ͳͷͰϦμΠϨΫτ͸ߦΘΕͳ͍  ֤ೖྗϑΟʔϧυͷγϣʔτίʔυΛొ࿥ BEE@TIPSUDPEF   ϖʔδදࣔ

    UIF@DPOUFOU    8PSE1SFTTͷը໘ද͕࣮ࣔߦɺ.881'PSNͷγϣʔτίʔυͷ࣮ߦ͕ߦΘΕɺ
 ϑΥʔϜ͕දࣔ͞ΕΔ  ֬ೝϘλϯԡԼ  ݱࡏදࣔதͷը໘ʹ1045  ૹ৴ϘλϯԡԼ  ݱࡏදࣔதͷը໘ʹ1045 ೖྗը໘ 1045 Wݱࡏ
  16.  લड़ͷॳظԽॲཧΛ࣮ߦ  @1045ʹ8PSE1SFTT΁ͷϦΫΤετ RVFSZ@WBST ͱಉ໊ͷΩʔؚ͕·Ε͍ͯΔ৔߹ɺ ͦͷRVFSZ@WBSTΛ࡟আ  ϑΝΠϧͷΞοϓϩʔυ͕͋Δ৔߹ɺϦμΠϨΫτͷલʹҰ࣌σΟϨΫτϦʹอଘ 

    όϦσʔγϣϯΤϥʔͳ͠  ֬ೝը໘΁ϦμΠϨΫτ  όϦσʔγϣϯΤϥʔ͋Γ  όϦσʔγϣϯΤϥʔը໘΁ϦμΠϨΫτ ೖྗը໘⒌ ϦμΠϨΫτ IUUQFYBNQMFDPN OBNFࢁాଠ࿠ ໊͓લɿ<NXGPSN@UFYUOBNFlOBNFz> Wݱࡏ
  17.  લड़ͷॳظԽॲཧΛ࣮ߦ  όϦσʔγϣϯΤϥʔͳ͠  ͦͷ··֬ೝը໘Λදࣔ  όϦσʔγϣϯΤϥʔ͋Γ  όϦσʔγϣϯΤϥʔը໘΁ϦμΠϨΫτ

     ֤ೖྗϑΟʔϧυͷγϣʔτίʔυΛొ࿥ BEE@TIPSUDPEF   ϖʔδදࣔ UIF@DPOUFOU    8PSE1SFTTͷը໘ද͕࣮ࣔߦɺ.881'PSNͷγϣʔτίʔυͷ࣮ߦ͕ߦΘΕɺ ϑΥʔϜ͕දࣔ͞ΕΔ  %#ʹҰ࣌తʹอଘͨ͠ૹ৴σʔλΛ࡟আ XQ@GPPUFS   ໭ΔϘλϯԡԼ  ݱࡏදࣔதͷը໘ʹ1045  ૹ৴ϘλϯԡԼ  ݱࡏදࣔதͷը໘ʹ1045 ֬ೝը໘ 1045 Wݱࡏ
  18.  લड़ͷॳظԽॲཧΛ࣮ߦ  @1045ʹ8PSE1SFTT΁ͷϦΫΤετ RVFSZ@WBST ͱಉ໊ͷΩʔؚ͕·Ε͍ͯΔ৔ ߹ɺͦͷRVFSZ@WBSTΛ࡟আ  όϦσʔγϣϯΤϥʔͳ͠ 

    ϝʔϧͷૹ৴ॲཧΛ࣮ߦ  ׬ྃը໘΁ϦμΠϨΫτ  όϦσʔγϣϯΤϥʔ͋Γ  όϦσʔγϣϯΤϥʔը໘΁ϦμΠϨΫτ ֬ೝը໘⒌ ϦμΠϨΫτ Wݱࡏ
  19.  લड़ͷॳظԽॲཧΛ࣮ߦ  όϦσʔγϣϯΤϥʔͳ͠  ͦͷ··׬ྃը໘Λදࣔ  όϦσʔγϣϯΤϥʔ͋Γ  όϦσʔγϣϯΤϥʔը໘΁ϦμΠϨΫτ

     ֤ೖྗϑΟʔϧυͷγϣʔτίʔυΛొ࿥ BEE@TIPSUDPEF   ϖʔδදࣔ UIF@DPOUFOU    8PSE1SFTTͷը໘ද͕࣮ࣔߦɺ.881'PSNͷγϣʔτίʔυͷ࣮ߦ͕ߦΘΕɺ
 ׬ྃը໘ϝοηʔδ͕දࣔ͞ΕΔ  %#ʹҰ࣌తʹอଘͨ͠ૹ৴σʔλΛ࡟আ XQ@GPPUFS ׬ྃը໘ Wݱࡏ
  20.  લड़ͷॳظԽॲཧΛ࣮ߦ  όϦσʔγϣϯΤϥʔ͋Γ  ͦͷ··όϦσʔγϣϯΤϥʔը໘Λදࣔ  ֤ೖྗϑΟʔϧυͷγϣʔτίʔυΛొ࿥ BEE@TIPSUDPEF 

     ϖʔδදࣔ UIF@DPOUFOU    8PSE1SFTTͷը໘ද͕࣮ࣔߦɺ.881'PSNͷγϣʔτίʔυͷ࣮ߦ͕ߦΘΕ
 ϑΥʔϜ͕දࣔ͞ΕΔ  %#ʹҰ࣌తʹอଘͨ͠ૹ৴σʔλΛ࡟আ XQ@GPPUFS όϦσʔγϣϯΤϥʔը໘ Wݱࡏ
  21. ͳΜͰ@4&44*0/Λ࢖Θͳ͍ͷʁ $PMVNO

  22. w ϑΥʔϜͷૹ৴σʔλΛ࣋ͪճΔํ๏͸ओʹͭ  ೖྗը໘Ͱ͸ೖྗϑΟʔϧυɺ֬ೝը໘Ͱ͸ IJEEFOϑΟʔϧυ࢖͍1045Ͱ࣋ͪճΔ  ૹ৴͞ΕͨσʔλΛ@4&44*0/ʹอଘͯ͠
 ࣋ͪճΔ

  23. w 1045Ͱ࣋ͪճΔํ๏͸ը໘ભҠͷίϯτϩʔϧ͕໘౗ͳͷ ͱɺϦϩʔυͨ͠ͱ͖ʹʮ࠶ૹ৴͠·͔͢ʁʯతͳϒϥ΢βΞ ϥʔτ͕ग़Δͷ͕͏ͬͱ͏͍͠ w @4&44*0/Λ࢖͏ͷ͕Ұൠతͳํ๏ͩͱࢥ͏͕ɺ؀ڥʹΑͬͯ ͸ಈ͔ͳ͍͜ͱ͕͋ͬͨΓɺεέʔϧΞ΢τ͢Δͱ͖ʹ໘౗ w ͪͳΈʹ8PSE1SFTTຊମ΋@4&44*0/Λ࢖͍ͬͯͳ͍ w

    .881'PSN͸΋ͱ΋ͱ@4&44*0/Λ࢖͍͕ͬͯͨɺ্هͷ Α͏ͳ͜ͱ͕ؾʹͳΓɺ5SBOTJFOU"1* Ұ࣌తͳσʔλΛ%# ʹΩϟογϡ͢Δػೳ Ͱٖࣅతʹηογϣϯػೳతͳ΋ͷΛ ࡞ΓɺͦΕΛ࢖͏Α͏ʹมߋ
  24. ϝʔϧૹ৴ॲཧ͸Ͳ͏΍Δͷʁ $PMVNO

  25. w ΋ͱ΋ͱ͸ࣗ࡞͍ͯͨ͠ɻNC@TFOE@NBJM  w Ͱ΋ࣗલ͸؀ڥ໰୊ͱ͔ΊΜͲ͍͘͞͠ةݥ w 8PSE1SFTTͷXQ@NBJM Λ࢖͏ͷ͕٢ 
 


    XQ@NBJM UP TVCKFDU NFTTBHF IFBEFST BUUBDINFOUT 
  26. ϑοΫΛ࢖ͬͨ
 .881'PSNͷΧελϚΠζ

  27. ϝʔϧૹ৴࣌ͷϑΟϧλʔϑοΫ w NXGPSN@BVUP@NBJM@SBX@NXXQGPSNYYY
 \OBNF^ม׵લͷࣗಈฦ৴ϝʔϧΛॻ͖׵͑ΔϑοΫ w NXGPSN@BVUP@NBJM@NXXQGPSNYYY
 \OBNF^ม׵ޙͷࣗಈฦ৴ϝʔϧΛॻ͖׵͑ΔϑοΫ w NXGPSN@BENJO@NBJM@SBX@NXXQGPSNYYY
 \OBNF^ม׵લͷ؅ཧऀѼϝʔϧΛॻ͖׵͑ΔϑοΫ

    w NXGPSN@BENJO@NBJM@NXXQGPSNYYY
 \OBNF^ม׵ޙͷ؅ཧऀѼϝʔϧΛॻ͖׵͑ΔϑοΫ
  28. ϝʔϧૹ৴࣌ͷΞΫγϣϯϑοΫ w NXGPSN@CFGPSF@TFOE@BENJO@NBJM@NXXQGPSNYYY
 ؅ཧऀѼϝʔϧૹ৴௚લͷϑοΫ w NXGPSN@CFGPSF@TFOE@SFQMZ@NBJM@NXXQGPSNYYY
 ࣗಈฦ৴ϝʔϧૹ৴௚લͷϑοΫ w NXGPSN@BGUFS@TFOE@NXXQGPSNYYY
 ؅ཧऀѼϝʔϧɺࣗಈฦ৴ϝʔϧૹ৴ޙͷϑοΫ

  29. ಠࣗόϦσʔγϣϯϧʔϧͷ௥Ճ w ຊจϨϕϧ w ຊจϨϕϧ w ຊจϨϕϧ w ຊจϨϕϧ w

    ຊจϨϕϧ class MW_Validation_Rule_Foo extends MW_Validation_Rule { protected $name = ‘foo’; public function rule( $key, array $options = array() ) { if ( ΤϥʔʹͳΔ৚݅ ) { return ‘Τϥʔϝοηʔδ’; } } public function admin( $key, $value ) { ?> <label> <input type="checkbox" <?php checked( $value[$this->getName()], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][<?php echo esc_attr( $this->getName() ); ?>]" value="1" /> όϦσʔγϣϯϧʔϧ໊ </label> <?php } } // ͜Ε͸কདྷతʹෆཁʹ͢Δ༧ఆ add_filter( 'mwform_validation_rules', function( $validation_rules ) { $validation_rules[‘foo’] = new MW_Validation_Rule_Foo(); return $validation_rules; } );
  30. ಠࣗೖྗϑΟʔϧυͷ௥Ճ w ͪ͜Β͸ϑοΫෆཁͰɺ .8@81@'PSN@"CTUSBDU@'PSN@'JFMEΫϥεΛܧঝ͠ ͨΫϥεΛ࡞ΓJODMVEF͢Δ͚ͩͰ௥Ճ͞Ε·͢ w ίʔυ͕௕ͯ͘αϯϓϧ͕ࡌͤΒΕͳ͍ͷͰ͜͜Λ͝ࢀ র͍ͩ͘͞ʜ
 IUUQTHJUIVCDPNJODNXXQGPSNCMPC NBTUFSDMBTTFTGPSNpFMET

  31. ΧελϜϝʔϧλάͷ௥Ճ w ϝʔϧૹ৴࣌ʹΦϦδφϧͷʮϝʔϧλάʯΛఆٛ͢Δػೳ w ྫ͑͹ϝʔϧ಺༰ͷઃఆͰ\TFOE@EBUFUJNF^ͱͨ͠ͱ͖ʹૹ ৴೔࣌ʹม׵͞Εͯϝʔϧૹ৴ͤ͞Δͱ͍͏͜ͱ͕Մೳ add_filter( 'mwform_custom_mail_tag', function( $value,

    $key, $inserted_inquiry_id ) { if ( $key === 'send_datetime' ) { return date( 'Y/m/d l H:i:s' ); } return $value; }, 10, 3 );
  32. ϑΥʔϜ಺༰ͷ਽ܗΛఆٛ͢Δ w $POUBDU'PSN͸ϑΥʔϜ࡞੒࣌ʹϑΥʔϜͷ਽ܗ͕ೖྗ͞ Ε͍ͯ·͕͢.881'PSN͸ͦ͏ͳ͍ͬͯ·ͤΜ w ඞཁͳํ͸ϑοΫͰ௥ՃͰ͖·͢ /** * ςʔϚ಺ inc/mw-wp-form-default-content.php

    Λ਽ܗͱͯ͠ར༻͢Δαϯϓϧ */ add_filter( 'mwform_default_content', function( $content ) { ob_start(); get_template_part( 'inc/mw-wp-form-default-content' ); return ob_get_clean(); } );
  33. ϚωλΠζ

  34. ΞυΦϯൢച .881'PSNʹؔ͢Δػೳ։ൃґཔ

  35. ΞυΦϯൢച

  36. ͍·ൢച͍ͯ͠Δ΋ͷ w .881'PSN(FOFSBUPS
 ϑΥʔϜ࡞੒ΛΤσΟλܗࣜͰ͸ͳ͘(6*ܗࣜʹมߋ͢Δ
 σβΠϯͷఏڙɻεΩϯػೳͰ੾ସՄೳ
  ԁ ੫ൈ  w

    .881'PSN$"15$)"
 ΩϟϓνϟೝূϑΟʔϧυΛ௥Ճ͢Δ
  ԁ ੫ൈ
  37. ΋ͱ΋ͱൢച͍ͯͨ͠΋ͷ w .881'PSN4UBOEBSE
 ϑΥʔϜ࡞੒࣌ʹϑΥʔϜͷ਽ܗ͕ೖྗ͞ΕΔΑ͏ʹͳΔ
 σβΠϯͷఏڙɻεΩϯػೳͰ੾ସՄೳ
 ԁ ੫ൈ

  38. w )5.-ܗࣜͷ਽ܗΛఏڙ͢Δܗͩͱ)5.-ߏ଄Λม͑ Δ͜ͱ͕Ͱ͖ͳ͍ͷͰσβΠϯεΩϯͷ࡞੒ʹ੍ݶ͕ Ͱ͖ͯ͠·͏ w .881'PSN4UBOEBSEΛ΍ΊͯɺϢʔβʔ͕)5.- Λҙࣝ͠ͳ͍ܗͰϑΥʔϜ࡞੒΍εΩϯͷબ୒͕Ͱ͖ Δ.881'PSN(FOFSBUPSΛൢച

  39. w ػೳ͕ҧ͏΋ͷͷɺ࠷ऴతʹϢʔβʔʹఏڙ͢ΔՁ஋  )5.-΍$44͕ॻ͚ͳͯ͘΋੔ͬͨϑΥʔϜ͕࡞੒Ͱ ͖Δ ͸΄΅ಉ͡ w ֹ͕ۚഒʹͳΔͷͰൢചݸ਺͸ݮΔͷͰ͸ʜ

  40. w ൢചݸ਺ʹӨڹ͸ͳ͘ɺ঎඼Ձ֨ͷΞοϓʹൺྫͯ͠ച Γ্͛΋Ξοϓ w (6*ػೳͷఏڙͱ͍͏৽͍͠෇ՃՁ஋ͷ௥Ճ͸͋ͬͨ ΋ͷͷ ಛผ҆͘͠ͳͯ͘΋ചΕΔ΋ͷ͸ചΕΔ w ͨͱ͑҆ͨ͘͠΄͏͕ൢചݸ਺͕૿͑Δͷͩͱͯ͠΋ɺ ಉ͡ചΓ্͛Λ͋͛Δʹ͸ֹۚʹൺྫͨ͠ݸ਺ΛചΒͳ

    ͍ͱ͍͚ͳ͍ͷͰ҆͘͢Ε͹͍͍ͱ͍͏΋ͷͰ͸ͳ͍
 
  ԁചΓ্͛Δʹ͸ ԁͳΒݸͰ͍͍͕
 ԁͳΒݸͷൢച͕ඞཁ
  41. .881'PSNʹؔ͢Δػೳ։ൃґཔ

  42. w ࣄۀചΓ্͛ͷ͍͍ͩͨʙ͘Β͍
 .881'PSNΛؚΊαΠτશମͷ։ൃͱ͔΋͖͋ͬͯͬͪΓΘ͚Εͳ͍
 ΋ͷ΋͋ΔͷͰ͓͓Αͦ  w .881'PSNʹؔ͢Δґཔ͸ίϛϡχςΟͳͲͰ΋ͱ ΋ͱ஌Γ߹͍ͷํ͔Βͷґཔׂ͕͍͍ͩͨɺશવ໘ࣝ ͷͳ͍ํ͔Βͷґཔׂ͕͍͍ͩͨ w

    ໘ࣝͷͳ͍ํ͔Βͷґཔ͸୯ൃɾ୯ػೳͷ৔߹͕ଟ͍ɻ ͦͷͨΊ͔ґཔ͔Βೲ඼·Ͱϝʔϧ͚ͩͰ׬݁͢Δ͜ ͱ͕΄ͱΜͲ
  43. ࠓޙͷల։

  44. ΞυΦϯൢച w ചΓ্͛͸্͕Γ΋ͤͣԼ͕Γ΋ͤͣͳঢ়ଶ͕ଓ͍͍ͯΔ w ݱঢ়ϚʔέςΟϯάͷྨ͸Ұ੾͍ͯ͠ͳ͍ͷͰϦεςΟϯά޿ ࠂͷӡ༻͘Β͍͸ͯ͠Έ͍ͨͷͰ͕͋͢ͱ͸ԿΛ͢Ε͹ྑ͍ͷ Ͱ͠ΐ͏ʜʢ੾࣮ w ੥ෛۀ຿ʹൺ΂Δͱ΄΅ख͕͔͔Βׂ͕ͣྑ͍ͷͰ৳͹͍ͯ͠ ͖͍ͨ


    ࠓߟ͍͑ͯΔͷ͸(FOFSBUPSͷεΩϯ௥Ճ*NQPSUFSɾ&YQPSUFSͷ։ൃ  w ੥ෛ͕ࣄۀͷओମͳͷͰͳ͔ͳׂ͔͕͚࣌ؒͳ͍ͷ͕໰୊
  45. .881'PSNຊମ w ίʔυ͕͋·Γ͔͚ͳ͍ͱ͖͔Βʙ೥͘Β͍։ൃ͠ଓ͚͍ͯΔ ͨΊٕज़తෛ࠴͕݁ߏ͋ΔɻͰ΋ޙํޓ׵ੑͷ͜ͱΛߟ͑Δͱม ߋ͕೉͔ͬͨ͠Γɺ΋͏ϜϦͳ෦෼΋ଟ͍ w ࠓճ࣮ߦϓϩηεΛจࣈىͯ͜͠͠ɺॲཧ͕ൿ఻ͷλϨతʹ݁ߏ ෳࡶԽͯ͠ΔͳͱࢥͬͨͷͰɺ΋͏গ͠γϯϓϧͳํ޲ͰϦϑΝΫ λϦϯάΛ͸͡Ί͍ͯ·͢ɻͰ΋ޙํޓ׵ੑʜ
 IUUQTHJUIVCDPNJODNXXQGPSNUSFFGFBUVSF

    SFGBDUPSJOH w (JU)VCͰެ։͍ͯ͠ΔͷͰɺJTTVFɾϓϧϦΫେ׻ܴͰ͢ʂ
 IUUQTHJUIVCDPNJODNXXQGPSN