As alluded to last week, some expansions have come to the SPLOTbox media collector theme for WordPress.

It made sense to add support for image-type media, making the SPLOTbox perhaps a bit broader than TRU Collector. This was relatively easy, so a SPLOTbox site can accept uploads of images (JPG, PNG, GIF), or add them by direct link to a URL, but also through autoembed of flickr.

And built in support is baked in for MixCloud (audio), Giphy (you know what they offer, right?), plus Slideshare and Speakerdeck (presentations).

All of these are in play, and you can see examples on the demo site at http://splot.ca/box

And this all works if you want a Big Box of All Kinds of Media. But I thought there might be use cases where a site should just accept certain types of media, say for curating videos, or maybe just audio.

So as of now (or 30 minutes ago), the theme options includes checkboxes to designate the media sites that are supported via URL:

Options screen for Media supported Bu URL, checked are flickr, giphy, mixcloud, soundcloud, TED Talk video, vimeo, and YouTube.
You can now choose which media sites are supported by SPLOTbox.

These are then reflected on the front end share form as the list of sites supported (and if URLs for unsupported ones are entered, you see an error message).

Changing the theme options lists only the ones checked as supported (note Metacafe appears because this site runs an extra experimental plugin to extend support to more sites, this remains to be published as a plugin as it is pretty crude now).

If you update a site, there is a small chance on first load none will be checked, I’ve yet to isolate the use cases where this happens. This just means you have to check the ones you want to enable.

There also have been simplications on many of the SPLOTs to reduce the reliance on code in page templates for generating a link to a random item. I was able to pull that out into the general code (this is part of a secret SPLOT project I will hint at below) (that’s for any human that might be reading this) (hi human).

What I had done on many of my themes is to have a WordPress page template named page-random.php that was merely code.

This means to generate a URL for random content at a site located at http://somesite.fuzzy/, a Page is created with a URL slug of random and then http://somesite.fuzzy/random does the redirect work.

But this is all done in theme code now! Magic? Nah. The first part is registering a query parameter that the site can accept, like ?random=1

Then we need to add a rewrite rule for /random to be picked in a URL:

And now we can handle the logic that was in the template in the theme functions:

Why is this a big deal? Well it’s not. But I am working through what might be a major leap for SPLOTkind… it means pulling all of the functionality out of a theme template… and into a yet to be fully fleshed out plugin. It means a major amount of re-coding the SPLOT logic, but if it works, it could mean the SPLOT functionality could be independent of theme.

That’s a lot of maybes for now, but so far the work is progressing well.

This new version of SPLOTbox is been tested on a few of my sites, but I could certainly stand for anyone out there to give it a go on your own site – get the latest version at https://github.com/cogdog/splotbox

Maybe you will see colored muffin tins.


Featured Image: Modified by adding SPLOTbox theme image to Muffin Tin Monday – Sweets & Treats lunch flickr photo by anotherlunch.com shared under a Creative Commons (BY) license

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Leave a Reply

Your email address will not be published. Required fields are marked *