Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Apox

Members
  • Joined

  • Last visited

  1. Im trying to fetch data from twitch and have it output it using different css whether the streamer is online or offline. But i cant get it to work, it just says the streamer is offline. function twitch_streams_widget() { // Try to retrieve a stream from cache to avoid external calls $stream = wp_cache_get( 'featured_stream' , 'apoc' ); if ( false === $stream ) { // The list of valid streamers $streamers = array( 'guratw' => 'guratw' ); // Shuffle the array $keys = array_keys( $streamers ); shuffle( $keys ); $new = array(); foreach($keys as $key) { $new[$key] = $streamers[$key]; } $streamers = $new; // Loop through streamers in a random order, and pull their info foreach ( $streamers as $name => $user ) { // Get the Twitch data $twitch_response = json_decode( @file_get_contents( "https://api.twitch.tv/kraken/streams/" . $user ) ); $is_online = isset( $twitch_response->stream->game ); $game = $is_online ? $twitch_response->stream->game : false; // Are they online and playing Titanfall? if ( $is_online && $game == "Titanfall" ) break; } // If we have an online user, report it $url = 'http://twitch.tv/'.$user; $viewers = $is_online ? intval( $twitch_response->stream->viewers ) . " Viewers" : "Offline"; $icon = $is_online ? '<i class="icon-ok"></i>' : '<i class="icon-remove"></i>'; $status = $is_online ? 'online' : 'offline'; $stream = '<a class="twitch-stream-name '.$status.'" href="'.$url.'" target="_blank">'.$name.' '.$icon.'</a><span class="activity-count twitch-stream-count">'.$viewers.'</span>'; // Set it to the cache wp_cache_set( 'featured_stream' , $stream , 'apoc' , 180 ); } // Display the widget ?> <div class="widget featured-stream-widget"> <header class="widget-header"><h3 class="widget-title">Featured Stream</h3></header> <div id="featured-stream"> <?php echo $stream; ?> </div> </div> <?php } Anyone that can tell me what the problem is ?

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.