WordPress

Twitch Conditional – A WordPress Plugin for Twitch Streamers

I love Twitch. I actually spend my work day with one browser dedicated to Twitch, and subscribe to MrHappy’s daily Stream. So when rumors surfaced a few years ago their API, of course I wanted a way to interface with that API.

In doing research, I realized that a lot of streamers don’t have real websites. A few of the top ones do, but I think it’s because the automation between Twitch and a true website is “iffy” – you have to manually update every time your stream goes live, and that takes precious time away from interacting with the community (and actually streaming).

What if there was a way to automatically update your website to let people know that you were streaming – and that would turn itself off once the stream was over.

Twitch Conditional

I love the way WordPress handles conditional statements; there’s very specific “if” statements built into the core, and it lets you check for any number of flags to be set – is it a Category? is it a Tag? is it page two of some random archive? There’s a conditional for that. So what if there was a way to work with Twitch the same way?

The Twitch Conditional WordPress plugin allows you to see when you – or your favorite streamer – is online, and hides/shows content accordingly.

This plugin takes one variables in the options panel: a Client ID. You can get that from your profile: https://www.twitch.tv/settings/connections. Log in, generate a client ID, and then put it in the options pane. That’s the only set up you need.

When you’re developing your website, you can use something similar to this:

<?php if (twitch_is_live('username')) { ?>
    <p><a href="##twitch_url##">Currently Streaming Live!</a></p>
<?php } else { ?>
    <p>This Twitch user is currently offline!</p>
<?php } ?>

Breaking that down: If USERNAME is live, display a link to the twitch stream. If not, display some text that says the user is offline.

You could get really in-depth, hiding and showing entire sections of the site, embedding your twitch stream into the section so that it shows up when you go online. Or you could do a simple offline/online check with a special icon.  The possibilities are endless.

One day I’ll edit this plugin to have shortcodes – for now, the developer piece is what I was really wanted to get finished.

You can download the plugin here, on Github: https://github.com/thatmitchcanter/twitch-conditional


Our Specialities

Web Design & Development

From an idea and some notes to a fully functioning website, if you can dream it, Mitch can design and build it!

Twitch Marketing

We show you how to work with the most interesting content creators on the planet - Twitch streamers!

Social Media & Marketing

We give you the tools, training, and resources you need to get your story told on Twitter, Instagram, and more!

Brand Identity Design

A new logo, color palette, or even an entire style guide - we can help with a brand new brand (and the resources to keep your assets in line!)

Content Strategy & Creation

Want to start a podcast? A YouTube channel? A Twtich stream? Take it from an old pro - you've come to the right place!

eCommerce Consultation

Whether it's a digital service or a physical product, we can get you up and selling quickly and easily!

Community Management

Find your tribe and make them your rabid fans. Mitch can help with the technical ins-and-outs of it all!

Contact Greyhawk Digital