• Resolved bkjproductions

    (@bkjproductions)


    The way this works right now is great, but could we have the standard WordPress “Playlist” instead of a series of individual “Players”? Then on a podcast with a lot of episodes you would have just one short playlist, instead of something that scrolled on and on…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter bkjproductions

    (@bkjproductions)

    I stitched together your excellent work with another plugin by Birgire to use the WP playlist for external files. This can be found at https://wordpress.stackexchange.com/questions/141766/making-audio-playlist-with-external-audio-files.

    Somewhere in your file around line 56, remove the loop you’re doing and replace it with this, which basically takes all of those mp3 files and wraps them into a shortcode to be handled by the Birgire plugin. Of course this could be implemented more elegantly, and/or your admin interface could offer the Playlist format leveraging if the Birgire plugin is active, etc.

    // We just define a default icon that is handy; we have some favicons at root:
    $image = '/apple-icon-72x72.png';
    // create an array for output:
    $output = array();
    ?>
    	<ul class="podcast_feed">
    		<?php if ( $maxitems == 0 ) : ?>
    		<li><?php _e( 'No items', 'dkpp-domain' ); ?></li>
    		<?php else :
    			foreach ( $feed_items as $item ) :         	
    				if ($enclosure = $item->get_enclosure()) {
    					$audio = $enclosure->get_link();
    				}
    				$title = $item->get_title();
    				$description = addslashes( wp_trim_words(strip_tags($item->get_description()), 14, '...' ) );
    				$output[] = "[wpse_trac src='$audio' title='$title' meta_album='$description' thumb_src='$image' ]";
    	        	endforeach; ?>
    	    <?php endif; 
    		// build off our shortcode and then do it:
    		// sort it if you want: asort($output);
    		// build a shortcode using Birgire's plugin: WPSE Playlist found on Github
    		$output = '[wpse_playlist type="audio" tracklist="true" tracknumbers="false" images="true" artist="true"]' .
    			implode('', $output).
    			'[/wpse_playlist]';
    		if (class_exists( '\birgire\Playlist' )) { echo do_shortcode($output); }
    		else {echo "You need to have Birgire's plugin from https://github.com/birgire/wpse-playlist activated.";}
    		?>
    	</ul>
    	<?php echo $args['after_widget'];
    
    Plugin Author douglaskarr

    (@douglaskarr)

    Thanks and that’s a solid mashup but I’m not going to add a dependency to this on the other player. My objective was to use the WordPress default audio player. The purpose of this plugin is just to provide a step up from the default RSS widget which has no image or audio support.

    bkjproduction, I’d love to figure out how you did this. I have installed WPSE “Playlist shortcode for external files” by Birgir and I have attempted to follow your instructions, but it doesn’t seem to work. Is there any chance you could provide more detailed info such as the exact code in the loop that needs to be replaced? Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Playlist instead of Player?’ is closed to new replies.