Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #190180

    I was playing with the theme last night and took me a bit to figure out that the theme recognizes Soundcloud and embeds perfectly. You have to treat it as a video. And paste the url in the field for a link. I went to \wp-content\themes\enfold\config-templatebuilder\avia-shortcodes\video.php and hacked a few lines of code, as the embed was coming up screwy due to the 16-9 default format for videos (the dropdown for custom sizes is way down scrolled and prob won’t be noticed by some novice users).

    	function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
    			{
    	
    	
    				if(preg_match('/soundcloud/',$atts['src'])&&($atts['height']>4)){
    			
    				$atts['height']=4;//resets the height to 4 (from 9) so the embed looks better
    				$atts['format']='custom';
    			
    			
    				}

    Basically the hack just helps ensure your users don’t have to go in and start chopping away at the automatically-generated shortcode. I tested it as a single post view, and as a syndicated news item. To get it to show up in a feed, make sure your settings are “full content”. Just put “read more” breaks in the post to chop it in the news feed wherever you like for each post.

    Using the custom format, users can change the dimensions of the iframe, but like I said, it might be missed. This hack corrects that oversight with 4 lines of code.

    • This topic was modified 10 years, 8 months ago by brandonguy.
    #190520

    Hey brandonguy!

    Actually I’m not sure if this hack is the best solution. You can also use the default embed shortcode: http://codex.wordpress.org/Embeds which also supports Soundcloud .

    Regards,
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Soundcloud embed fix’ is closed to new replies.