Thanks for your effort. I really try to forward all informations to the guy helping us to update the code, as I’m not able to do it. Unfortunately, even content of the “main wrapper” still don’t work and the image displays “Offline”, even when streaming over the channel.
In details this means:
<!-- BEGIN MAIN WRAPPER (show only if Twitch channel name entered) -->
<?php if( get_theme_mod('sst_channel_name') != '') {
$channel=get_theme_mod('sst_channel_name');
$url0="https://api.twitch.tv/helix/users?login=".$channel;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/vnd.twitchtv.v5+json',
'Client-ID: ls2awgx5gfg9m1q6iopdqb1b7d0y6a'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url0);
$result=curl_exec($ch);
$array0=json_decode($result, true);
$channel_id=$array0["data"][0]["id"];
$url1="https://api.twitch.tv/kraken/streams/".$channel_id;
curl_setopt($ch, CURLOPT_URL,$url1);
$result=curl_exec($ch);
$array1=json_decode($result, true);
?>
<div class="sst-main-wrapper">
<?php include( plugin_dir_path( __FILE__ ) . 'include.php'); ?>
</div>
<?php } ?>
<!-- END MAIN WRAPPER (show only if Twitch channel name entered) -->
works (yet).
And this from your changes…
<!-- BEGIN MAIN WRAPPER (show only if Twitch channel name entered) -->
<?php if( get_theme_mod('sst_channel_name') != '') {
$url="https://api.twitch.tv/helix/streams?user_login=".get_theme_mod('sst_channel_name');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Client-ID: ls2awgx5gfg9m1q6iopdqb1b7d0y6a'
));
$result=curl_exec($ch);
$array1=json_decode($result, true);
?>
<div class="sst-main-wrapper">
<?php include( plugin_dir_path( __FILE__ ) . 'include.php'); ?>
</div>
<?php } ?>
<!-- END MAIN WRAPPER (show only if Twitch channel name entered) -->
works not.
Can it have something to do with the additional “include.php”-file as following?
<?php
$stream_url = "https://twitch.tv/".get_theme_mod('sst_channel_name');
if (get_theme_mod('sst_channel_url')!="") {
$stream_url = get_theme_mod('sst_channel_url');
}
?>
<a class="sst-twitch" <?php if( get_theme_mod('sst_new_window') != '') { ?>target="_blank"<?php } ?> href="<?php echo $stream_url; ?>" data-nickname="<?php echo get_theme_mod('sst_channel_name'); ?>">
<!-- BEGIN TWITCH LOGO -->
<div class="sst-twitch-logo-wrapper">
<div class="sst-icon-twitch"></div>
</div>
<!-- END TWITCH LOGO -->
<!-- BEGIN STATUS -->
<div class="sst-status-wrapper">
<div class="sst-status-wrapper-inner">
<!-- BEGIN IF ONLINE -->
<div class="sst-status-text-live">
<div class="sst-live-marker"></div>
<span>
<?php if( get_theme_mod('sst_live_text') != '') { ?>
<?php echo get_theme_mod('sst_live_text'); ?>
<?php } else { ?>
<?php esc_html_e( 'LIVE NOW! CLICK TO VIEW.', 'stream-status-for-twitch' ); ?>
<?php } ?>
</span>
</div>
<!-- END IF ONLINE -->
<!-- BEGIN IF OFFLINE -->
<div class="sst-status-text-offline">
<span>
<?php if( get_theme_mod('sst_offline_text') != '') { ?>
<?php echo get_theme_mod('sst_offline_text'); ?>
<?php } else { ?>
<?php esc_html_e( 'CURRENTLY OFFLINE', 'stream-status-for-twitch' ); ?>
<?php } ?>
</span>
</div>
<!-- END IF OFFLINE -->
</div>
</div>
<!-- END STATUS -->
</a>