03

WordPress Plugin Health Dashboard (Early POC)

In trying to get a better handle on how we’re going to manage our plugins in the future, I found the API for the WordPress.org plugins data. Not like they were hiding it but I’d not seen it before.Consider me Columbus– absent the genocide, slavery, and other terrible things. Replacing *slug* in the following URL gives you a pretty robust javascript With that option, I could build a little Google Sheet/Scripts viewer that would look up information based on a list of plugin slugs. I could set conditional formatting to do various things for visual cues . . . I could even build a little mini-algorithm to evaluate different aspects and weight them towards a total plugin score. I’m debating whether it’s worth working into a more sophisticated plugin that will tell me how many sites the plugin is installed on, display that data etc. There are plugins like that out there but they die on large multisite installations.1 I’d also like some way to tie into the vulnerable plugin announcements. Here are the two little functions that look up and write the plugin’s health based on the slugs being written in column A and a header in row 1. 1 I have a functional, if crude, option that paginates through them in a way that doesn’t crash/die.

WP API Posts Plugin

This is a little plugin I wrote while working with Jon Becker to build out the Ed Leadership Hub site. Essentially, we wanted students to be able to fill out a quick form and build out a profile page. As is my my wont, I went the Gravity Forms route. They could give a short bio, twitter account, and their portfolio URL. We’ll be tying in the the posts via Feed WordPress but it seemed like more hassle than it was worth to map the author id to this page. Pretty fun to be able to build out a solution on-the-fly and since all students were going to be in rampages I didn’t have to worry about WP not being upgraded or running from a non-HTTPS server. This chunk of the plugin builds out the HTML from the shortcode. You can see the data-url, data-num elements being populated. There’s a few other things in there I haven’t yet activated. Using data elements is the easiest way I’ve seen to pass variables to the javascript . . . the javascript looks for the altlab-getsposts id and then pulls the data elements from it. Once again, there’s some extra stuff in there for down the road that I haven’t implemented here.

Instagram-ish WordPress Filter Shortcode Plugin

That beautiful link-bait title and a picture of a dead leaf! That’s why I’m a social media guru. With that self-promotion out of the way . . . I found this CSS library from Una.1 It lets you apply instagram-like filters to image via CSS. Also got to have a nice interaction with Una via Twitter to clarify the license. @twoodwar :+1: its MIT so go ahead — Una Kravets (@Una) December 6, 2016 It fit a need that a professor was expressing for one of our WordPress installs so I wrapped it in a plugin/shortcode combination. The structure goes like so . . . [ cssgram img=”https://c2.staticflickr.com/6/5745/31413304786_48ab865a34_c.jpg” filter=”_1977″ ] Plain Image A Few Filtered Examples _1977 Inkwell Xpro2 1 Check out her site if you’re into developer stuff at all.

HTTPS Insecure Content Fixer Plugin

If you’ve got a site running on HTTPS and you try to throw in some HTTP content, the browser gets nervous. If you’ve recently made a shift to HTTPS you might notice content that was successfully embedded disappearing. If you look in the browser (right click>inspect element in Chrome), you’ll see an error like the one above. What you want in this scenario is protocol relative URLS . . . essentially a URL without the leading http/https. That lets the page load via the one protocol that matches (assuming it exists- some sites won’t supply HTTPS options).1 I ran into this problem with files we uploaded via Gravity Forms prior to the switch to HTTPS. There are a number of ways to deal with this (including search/replace at the database level) but we’re under a very heavy load at the moment and I just needed a quick fix. This solution will also allow people to do whatever they want on an ongoing basis better than a database response. This tiny little filter plugin is the result. All it does is use PHP’s preg_replace (regex) function to find any instances of HTTP or HTTPS (capital or lowercase) and remove them. I’m still amazed by regex but always end up having to spend a bit of time reminding myself of how it […]

Set Default Gravity Forms From Email

On rampages we only have the ability to send out emails from rampages.us addresses. This caused a bit of confusion for me when our Gravity Forms email notifications stopped working.1 It seems like Gravity Forms now defaults to send emails from the form admin’s email address. In our case, that’s a vcu.edu domain . . . . which causes the emails to fail. You can see that when you go to Settings>Notifications for a form. The From Email now says {admin_email}. We have Gravity Forms network activated on rampages which means it’s live on all 17,000+ sites. Granted, I have no real idea how many people use it but I didn’t relish the thought of how many questions this might cause. Luckily, Gravity Forms has a way to take care of this and I was able to write a tiny, little, itsy, bitsy plugin to set the from email for all our sites. Problem solved. 1 Tim, from the ever-reliable Reclaim Hosting guided me back to sanity after I tried to make this much harder than it needed to be.

Importing Moodle into WordPress

flickr photo shared by Internet Archive Book Images with no copyright restriction (Flickr Commons) A week or two ago some faculty members asked me about getting the Leadership Education in Neurodevelopmental Disabilities (LEND) content out of the Moodle hosted at Vanderbilt and into WordPress. I figured I could do this. Someone might even have done it already. If not, I figured the export options would have to put out something fairly straightforward that could be parsed. In any case, the majority of my learning comes from committing to things I don’t quite know how to do. Turns out I couldn’t find anyone who’d done this before. I went a variety of different routes as I attempted not to do the work myself. First, I exported the course in the two different flavors that were available (SCORM1/Course Cartridge and Moodle backup). Just for fun I tried a few different flavors of import plugins . . . Edwiser Bridge might have worked but required a higher level of connection to Moodle than I felt like dealing with and seemed more focused on integration rather than migration, Simple CSV Importer and WP All Import both failed to do what I needed despite pushing XML around a bit to try to make it work. So with all the ready-made solutions exhausted2 I turned to […]

CSV Parser Shortcode Plugin

flickr photo shared by The Library of Congress with no copyright restriction (Flickr Commons) The title just rolls off the tongue, yes? But what it does is kind of interesting. It’s not a drag/drop solution but it starts to show how we can better knit different services together. In this case, I run a Google Script to generate a spreadsheet of files (I can probably make that a straight up API connection in the near future). I publish that spreadsheet as CSV because Google sheets to JSON feels a good bit slower.1 Then the following shortcode (but w/in square brackets) generates the little unordered lists below. It’s taking that list of 464 files and just chopping out the ones where the filename’s first letters match A-1 and the parent folder is Tasks. Not brain surgery, right? But it is a pretty flexible solution to allow flexible access to any chunk of CSV (should work on any CSV on the web- assuming you adjust the elements to reflect the data) text you want to display portions of on the fly. People can do all their work in Google Drive and it seamlessly updates in WordPress. People without WordPress skills can update and change where these lists appear through a simple shortcode. To be clear, this is an integration rather than an […]

Put The Events Calendar Month View on Your Homepage

Because I’ve been messing with The Events Calendar for the RVArts project, along came another conversation where that plugin seemed like a good answer. It answered all their needs except for one – the wanted to have the month view of events be the homepage for the site. I knew that didn’t happen natively but I figured I could do it. The first step is to create a custom page template. There are a number of tutorials on how to do that. I usually just duplicate the page template for the theme I’m using as a parent and go from there. The one I’m using is below. The Events Calendar has this nice function (tribe_show_month) which’ll pull the month’s data by default. That’ll get you something that looks like below (depending on your theme). It’s the right content but it’s not applying the same CSS/JS that’s on the regular month view. You could go in and rewrite CSS and JS etc. but that would suck for this particular project. It turns out you have to enqueue the right stuff and this post was so very helpful in telling what to enqueue. I updated it to the newer functions and presto everything worked just like the normal month events view. It goes into my child theme’s functions.php. This particular version only […]

RVArts – Dealing with Dates in WordPress

We have an awesome general education course starting this semester called Cultural Passport (aka RVArts). The goal is to get students involved with the community’s cultural events – participating, promoting, reviewing them. The web side of this ends up being pretty interesting. See their video below for more details on the course. When we started this conversation last year, I thought I was going to go the Gravity Form submission route1 and use a js library to make it possible to add the events to various calendars. Like most projects, particulars shifted and we started changing things pretty radically right before winter break. We ended up shooting for full WordPress editor access for students to create events and the desire to write three different types of responses (interviews, reviews, and features) that would be associated with a specific event. Also, like most projects, this was all a bit beyond what I’d ever done before. I started off thinking I’d create a custom post type for events. I was trying to make up my mind between using Advanced Custom Fields and CMB to help do that when I realized I hadn’t really thought about repeat events. The complexities involved there really made me rethink my decision to do this from scratch. After that I started trying various plugins and eventually decided […]

#openupTRU – Simpler WordPress Writing POC

I’ve had a number of requests to simplify WordPress, to make it more Tumblr like. I get that. It was mentioned again while I was at Thompson Rivers University and that inspired me to get it done. WordPress has a lot more complexity than Tumblr and that allows you to do a lot more. Doing complex things often requires tools with some complexity. The thing that interests me is when and how you make that complexity visible.1 So could we do something more Tumblr like in WordPress? There are certainly ways to completely re-write the dashboard and to set up user roles that only have limited kinds of access. That seems a bit heavy-handed to me and I don’t want to wall this stuff off. I simply want to make things very accessible to inexperienced users. The full re-write is also somewhat beyond what I have the time to do. I could take the time but in “innovation” land time is energy lost and I must ride the mixed-metaphor wave of getting stuff done fast. So in the time honored spirit of throwing stuff together with duct tape, I offer this for consideration. WordPress does have a simplified authoring view. Really. You can activate it using the ‘Press This’ bookmarklet and despite a slick revamp in WP 4.2 virtually no […]