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

DB使わずWordPressのデータ取得

 DB使わずWordPressのデータ取得

第28回 中国地方DB勉強会 in 岡山
https://dbstudychugoku.connpass.com/event/158127/

※一部カットして公開しています

Masayuki Maekawa

January 25, 2020
Tweet

More Decks by Masayuki Maekawa

Other Decks in Technology

Transcript

  1. %#࢖Θͣ8PSE1SFTTͷσʔλऔಘ

    View full-size slide

  2. ͓஌Βͤͱ͔ɺϒϩάίϯςϯπͱ͔
    औΓࠐΉ͜ͱ͋Γ·͢ΑͶɻ

    View full-size slide

  3. લ઒ণ޾ʢ·͔͑Θ·͞Ώ͖ʣ
    w גࣜձࣾΦϛΧϨ
    w Ԭࢁࡏॅ
    w !NBFQPO
    w PLBZBNBKT

    View full-size slide

  4. ࠗ׆ͱ͍͑͹ΦϛΧϨ

    View full-size slide

  5. גࣜձࣾΦϛΧϨ
    ग़ձ͍͕Λ;&30ʹ͢Δ
    w ΤϯδχΞืूத
    w Πϯϑϥ
    w ϑϩϯτʴαʔόʔαΠυ

    View full-size slide

  6. IUUQTPLBZBNBKTDPOOQBTTDPNFWFOU

    View full-size slide

  7. %#࢖͑Δਓɺ͜͏͍͏͜ͱ͕ͪ͠

    View full-size slide

  8. <8PSE1SFTTͷΤϯτϦʔΛࣗલͰͳΜͱ͔͠Α͏ͱ͍ͯ͠Δ
    ίʔυ>

    View full-size slide

  9. ΧςΰϦʔͰͷநग़ͱ͔
    ೖΔͱ͞ΒʹΘͪΌΘͪΌ

    View full-size slide

  10. ࠓ͸͜Μͳײ͡

    View full-size slide

  11. <8PSE1SFTTͷ3&45"1*Λར༻͢Δίʔυ>

    View full-size slide

  12. 8PSE1SFTT3&45
    "1*

    View full-size slide

  13. ϒϩάͷ࠷৽هࣄΛऔΔ৔߹
    IUUQTQBSUZDBMFOEBSOFUCMPHXQKTPOXQW
    QPTUT

    View full-size slide

  14. ݅औಘ
    IUUQTQBSUZDBMFOEBSOFUCMPHXQKTPOXQW
    QPTUT QFS@QBHF
    ఴ෇ը૾΋औಘ
    IUUQTQBSUZDBMFOEBSOFUCMPHXQKTPOXQW
    QPTUT QFSQBHFFNCFE

    View full-size slide

  15. ͨͩ͠ɺσʔλ͕Ͱ͔͍

    View full-size slide

  16. நग़ͷ৚݅΋௕͘ͳΓ͕ͪ

    View full-size slide

  17. 8PSE1SFTTͰ"1*ͷ௥Ճ΋Մೳ

    View full-size slide

  18. ௥Ճͷྫ
    8PSE1SFTTͷςʔϚͷGVODUJPOTQIQʹ௥Ճ
    add_action('rest_api_init', function() {
    register_rest_route( 'omicale/v1', '/new_entry', array(
    'methods' => 'GET',
    'callback' => 'get_posts_whatsnew',
    ) );
    });

    View full-size slide

  19. ػೳ࡞੒
    લϖʔδͰఆٛͨؔ͠਺Λ࡞੒
    function get_posts_whatsnew($param){
    $limit = ($param->get_param('limit')
    && is_numeric($param->get_param('limit')))
    ? $param->get_param('limit') : 3;
    ʢҎԼུʣ

    View full-size slide


  20. ͜Μͳײ͡Ͱݺ΂ΔΑ͏ʹͳΓ·͢
    IUUQTQBSUZDBMFOEBSOFUCMPHXQKTPOPNJDBMFW
    DPNQBOZ
    OBNF&#&"&#&
    "'&"$&#$&"#

    View full-size slide

  21. ग़ྗ͢Δσʔλͷௐ੔΋Մೳ
    w ʮ͜͜ʹ8PSE1SFTT͔ΒҾͬு͖ͬͯͯʯ΋େৎ෉
    w ͍ΘΏΔϔουϨεͳߏ੒΋΍Ε͹Ͱ͖Δʂ

    View full-size slide

  22. ͋Γ͕ͱ͏͍͟͝·ͨ͠

    View full-size slide