In responding to some data requests, I delved into the WP tables to pull some rampages data.
All users ever . . .
I need to set up something more automated but for this I dumped the MySQL tables as CSVs and then just imported them to Google Sheets. With very minimal functions, I got this data.
Before Mark left us for the green dusty start-up fields of Austin TX we had a conversation about creating a better, faster way to do our examples page. The idea of having a resource like this is always popular but people don’t add content.I’ve done this more than a few times. My current belief is that it’s because it’s a hassle and despite good intentions people just don’t do it. After seeing what Mark did to associate users with their blogs in the mother blog plugin, I figured he could also automatically pull the theme, plugins, and admin email of any blog on our system based on the URL . . . and indeed he could. This theme requires Advanced Custom Fields and the Benson plugin to tie in the Angular stuff. The one thing he wasn’t able to do was to auto-generate the screenshot from the URL. I’ve looked into that in the past and done it in a variety of ways but none of them were quite satisfactory. I didn’t really want to end up reliant on a 3rd party system and then Mark sent me http2pic yesterday. So now I just needed to install it and get it working. That led to a bit of an adventure for me. There are directions on the github page but […]
Cowboy Jason Stanley performing a riding trick at the Round-Up, Pendleton, Oregon flickr photo by UW Digital Collections shared with no copyright restriction (Flickr Commons) I’ve been doing quite a bit more with the WordPress Rest API lately. There’s plenty of documentation and tutorials out there but most of it still feels a bit scattered to me so I’m going to stick a few of the basics here and add a few things that have come up repeatedly that aren’t quite as basic. There’s an attempt here to move upwards in complexity with the examples but to keep them as clean as possible. This will deal entirely with getting the data. I haven’t done much with using the API to write or modify data. Get the Info There are many ways to get data depending on your library of choice or if you’re using vanilla JS. I’ve played with fetch and Axios on the lighter side and jQuery, Vue, and Angular (v1) on the heavier/more involved side of things. I’ll use jQuery in this version because it’s fairly popular but here’s a Vue example. The example below does a basic jQuery ajax call for the JSON associated with blog information. See the Pen simple jquery get of WP JSON for the site by Tom (@twwoodward) on CodePen. The URL Structure/Accessing […]
flickr photo shared by Thomas Hawk under a Creative Commons ( BY-NC ) license This is in response to something Adam Croom wrote two(?) days ago. I thought it’d be an interesting proof of concept and would let me figure out some things with a purpose. I also like to have a few projects going on at once so I have things to switch between when I get frustrated. I also see this kind of information pushing/pulling as broadly applicable. Some of this stuff is no doubt uglier than it had to be but I’ll try to show some intersections that happened to occur with other projects and how certain steps might be ignored entirely if you want to be all efficient and stuff. The final plugin is here and should be a decent start to any customized import you want to run against a CSV file. Adam had information in Discogs. He wanted that information in WordPress where he could control it. I had never heard of the site, let alone seen its API. But it well documented and it took me a few minutes to realize I could get all the data I needed without even needing to authenticate. The user data was associated with collections and appending 0 would get me the root level stuff. With Adam’s […]