New PHP code still doesn’t work
<?php
function twitch_stream_live() {
$channel = 'overwatchleague';
$client_id = 'load your code';
$url = 'https://api.twitch.tv/kraken/streams/' . $channel . '?client_id=' . $client_id;
$response = wp_remote_get( $url );
if ( !is_wp_error( $response ) && $response['response']['code'] === 200 ) {
$body = json_decode( wp_remote_retrieve_body( $response ) );
if( twitch_stream_live() ){
<iframe
src="http://player.twitch.tv/?channel=dallas&muted=true"
height="720"
width="1280"
frameborder="0"
scrolling="no"
allowfullscreen="true">
</iframe>
} else {
do not load
}
}
return false;
}