• Home
  • About Mitch
  • Speaking
  • Articles
  • Contact
  • Home
  • About Mitch
  • Speaking
  • Articles
  • Contact

Digital Strategist

WordPress Developer

Content Creator

Unapologetic Punk

Mitch Canter

  • X
  • Bluesky
  • GitHub
  • Twitch
  • YouTube
  • LinkedIn
WordPress

Twitch Conditional – A WordPress Plugin for Twitch Streamers

CMDR Mitchcraft

Reading time: 2 minutes

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

  • WordPress, React, and The Future

    WordPress, React, and The Future

    Reading time: 1 minute

    On September 14, Matt Mullenweg announced that WordPress was rethinking its use of the React.js library due to Facebook’s clarification on its patents. The short story: Facebook released React under a modified “open-source-ish” license (called BSD+Patents) that allow them to judiciously revoke the patent if a service violates the terms of service (specifically, if they…

    WordPress
  • BlogInfo – One Tag with a Whole Lot of Awesomeness

    BlogInfo – One Tag with a Whole Lot of Awesomeness

    Reading time: 1 minute

    One of the most versitile tags in my arsenal that WordPress gives me is a fun little tag called <?php bloginfo(); ?>.  By itself, it’s not much fun, but when you add in a variable, it can tell you anything you need to know about your blog.  Like what, you ask? name description admin_email url…

    WordPress