Adding Soundcloud Support for Audio Post-Formats
-
I’m using this theme for a teacher’s site used to teach guitar, and they kept putting SoundCloud URLs in for the Audio Post Format, which of course does nothing. Since WordPress has auto embed, it was easy to add this as an modify to allow for this in
content-audio.php
<div class="post-audio"> <?php if ( strpos( $audio_url, 'soundcloud.com') === false ) {:?> <audio controls="controls" class="audio-player"> <source src="<?php echo $audio_url; ?>" /> </audio> <?php else: ?> <?php echo wp_oembed_get( $audio_url );?> <?php endif ?> </div> <!-- /post-audio -->
I use the same in
single.php
except to keep the embed form being too tall, the same code has<?php echo wp_oembed_get( $audio_url, array('height'=>240) );?>
Thanks again for such a useful theme.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Adding Soundcloud Support for Audio Post-Formats’ is closed to new replies.