A 15 tweet in 15 minutes slot for Hey Pressto! Conference 2020: A WordPress and ClassicPress conference which happens only on Twitter
Just saying “API” tunes out many people. It gets fuzzy in technical verbiage. Regardless of editor preference, this WordPress capability opens ways to do curious things outside the platform. I’m no guru but have wrangled a few ways of using the API that might make it appreciated.
— session link
CONFERENCE SESSION AS TWEETED
1/15 It's my turn for 15 minutes on the #HeyPresstoConf20 stage with "Doing Small Things With the WordPress API"
API… API… Does that sound like I know what I am talking about?
Just uttering the jargon "API" will drop a fog on most people… do you feel it? pic.twitter.com/VO92TUjIQr
— Alan Levine (@cogdog) September 24, 2020
Crazy Eyes GIF found on giphy
2/15 #HeyPresstoConf20 Search https://t.co/T9vuBavl3m for "About 2,210,000,000 results"
Maybe best is restaurant metaphor https://t.co/w2XVvwCGoP
It's a site saying, "hey gimme some content in a structured manner" to another in this case we can ask WordPress "whatchya got?"
— Alan Levine (@cogdog) September 24, 2020
3/15 #HeyPresstoConf20 "headless" WordPress? https://t.co/eoBmCzDGUF
Using WordPress and all its good for to create and manage content (regardless of editor), but use a more lightweight web front end to display that content.
Fine to replicate big corp sites, but… pic.twitter.com/JC4BMlqIiq
— Alan Levine (@cogdog) September 24, 2020
Headless Target flickr photo by cogdogblog shared into the public domain using Creative Commons Public Domain Dedication (CC0)
4/15 #HeyPresstoConf20 For fun try adding /wp-json/wp/v2/posts/ to any WordPress url or /wp-json/wp/v2/posts/?per_page=1 will get you the latest post or /wp-json/wp/v2/comments for 20 recent comments or /wp-json/wp/v2/search?search=splot will return search results for "splot"
— Alan Levine (@cogdog) September 24, 2020
5/15 #HeyPresstoConf20 To make readable and see structure copy results to https://t.co/HPGRMDs53S It's all plain text aka JSON format, so small amounts of data. I try simple HTML on laptop as localhost but you can do a ton (and find stuff) in https://t.co/JAKJwGl1qr pic.twitter.com/mFp5TeL82c
— Alan Levine (@cogdog) September 24, 2020
6/15 #HeyPresstoConf20 First small API thing- holder for top level of multisite, a bit mysterious. See https://t.co/StuTFzTVpx Random rotating messages are content of blog posts calling WordPress API on itself.
Blogged https://t.co/qOhsorunh4
— Alan Levine (@cogdog) September 24, 2020
7/15 #HeyPresstoConf20 Adding to TRU-Collector SPLOT a custom API endpoint to return random image/meta data, so SPLOT could be source for image-based activities- writing prompts?
Reload demo https://t.co/d0jAQWRmtg
Blogged https://t.co/p6NjJTs7e0 pic.twitter.com/OcKnB2Ftqa
— Alan Levine (@cogdog) September 24, 2020
Added SPLOT logo and some json code to The Super Green Lime Ice Cream Truck flickr photo by Señor Codo shared under a Creative Commons (BY-SA) license
8/15 #HeyPresstoConf20 What I had in mind was a https://t.co/se3sSM0goX fed from a SPLOT (rather then flickr) so one could be more control of images.
Random not built into WordPress API, so I added custom endpoints to the TRU-Collector themehttps://t.co/hT94dYaV9D
— Alan Levine (@cogdog) September 24, 2020
9/15 #HeyPresstoConf20 And just for fun try an extra javascript library on a calling site to add a glitch effect. https://t.co/mRNUIKQKMo
Public site is 4 files, sourcing data from WP site pic.twitter.com/BHkzDIhFO9
— Alan Levine (@cogdog) September 24, 2020
10/15 #HeyPresstoConf20 Next "small" WordPress API thing is a bit… bigger.
Project was WordPress resource site for Leadership Development https://t.co/EujSqpKFdj Looks nice.
Client desire was way (beyond email) busy managers could see what's new via mobile. Hmmm. pic.twitter.com/o3oKbPBHk7
— Alan Levine (@cogdog) September 24, 2020
12/15 #HeyPresstoConf20 Since site changes infrequently, the json is generated by a php script and stored as a static file on a file server #cheapcache
The entire site's content (89 posts plus 15 custom post types) is saved in 2 json files, 1.1Mb total pic.twitter.com/RzW0NhNgPe
— Alan Levine (@cogdog) September 24, 2020
Remix made on giphy of Chin Alot gif
13/15 #HeyPresstoConf20 "Fun" part of project was no custom theming; all built with out of the box premium theme and free plugins.
WP REST API Controller was key for customizing endpoints https://t.co/99HLODxmce
Posts on projecthttps://t.co/bDmC9TUy2j
— Alan Levine (@cogdog) September 24, 2020
14/15 #HeyPresstoConf20 Miles of code on CorrLeader Navigator blogged here https://t.co/VRjicMk43q Again a big thanks to @twoodwar for lots of code help via twtter DM Check Check his blog for more https://t.co/EIASn65njY pic.twitter.com/tpdCVFi8U0
— Alan Levine (@cogdog) September 24, 2020
15/15 #HeyPresstoConf20 I am nowhere near expert level in API land but with perseverance, banging the code, asking for help, I've stepped up my game at least to want to do more.
There's a lot to be said for doing small things.
Thanks for following my API blabbering. pic.twitter.com/3DEz66VvQ6
— Alan Levine (@cogdog) September 24, 2020
Public domain image from pxfuel