Changeset 2019463
- Timestamp:
- 01/26/2019 07:42:26 AM (7 years ago)
- Location:
- livetwitch/trunk
- Files:
-
- 2 edited
-
includes/class-twitch.php (modified) (5 diffs)
-
live-twitch.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
livetwitch/trunk/includes/class-twitch.php
r2019461 r2019463 220 220 return $this->version; 221 221 } 222 222 223 223 /** 224 224 * Create shortcode that takes 2 variables (count and singular). … … 248 248 $singletext = false; 249 249 250 if(!empty($atts['singletext'])){251 $singletext = true;252 }253 254 250 $viewers = $game = $link = $image = $stream_title = ""; 255 251 $streams = get_posts( 256 252 array( 257 253 'title' => $atts['singular'], // by post title 258 'post_type' => 'twitch' // post type of your preference 254 'post_type' => 'twitch', // post type of your preference 255 'meta_query' => 256 array( 257 'key' => 'type', 258 'value' => 'live', 259 ) 259 260 ) 260 261 ); … … 263 264 264 265 if(isset($cf['viewer_count'])){ 265 $viewers = $cf['viewer_count'][0]; 266 $viewers = $cf['viewer_count'][0]; 267 if(!empty($atts['singletext'])){ 268 $singletext = true; 269 } 266 270 } 267 271 if(isset($cf['game_id'])){ … … 297 301 if( is_array($streams) ){ 298 302 foreach($streams as $stream){ 299 $stream = array_map(array('LiveTwitchWidget','LiveTwitch_DisplayString'), $stream); 300 echo $this->display_stream($stream); 303 $stream = array_map(array('LiveTwitchWidget','LiveTwitch_DisplayString'), $stream); 304 if($stream['viewers'] != "N/A"){ 305 echo $this->display_stream($stream); 306 } 301 307 302 308 } 303 309 }elseif ($singletext) { 304 echo '<span class="livetwitch is-live">Live</span>'; 310 if($stream['viewers'] != "N/A"){ 311 echo '<span class="livetwitch is-live">Live</span>'; 312 } 305 313 }else { 306 314 $stream = array_map(array('LiveTwitchWidget','LiveTwitch_DisplayString'), $stream); 307 echo $this->display_stream($stream); 308 315 if($stream['viewers'] != "N/A"){ 316 echo $this->display_stream($stream); 317 } 309 318 } 310 319 … … 314 323 } 315 324 316 /**317 * Add filter for Twitch game name.318 *319 * @since 0.0.3320 * @access public321 * @var string $game Game name.322 */323 public static function display_singlelive($game) {324 livetwitch_get_template('single-live.php');325 }326 327 325 /** 328 326 * Add filter for Twitch game name. -
livetwitch/trunk/live-twitch.php
r2019461 r2019463 25 25 } 26 26 27 define( 'LiveTwitch', '0.0. 4' );27 define( 'LiveTwitch', '0.0.5' ); 28 28 /** 29 29 * The core plugin class that is used to define internationalization,
Note: See TracChangeset
for help on using the changeset viewer.