/** * Builds the HTML output for Nivo Slider * * @since 0.1 * @return void */ function boom_build_nivo_slider($slides = array(), $width = null, $height = null) { if ($width) { $width = "max-width: {$width}px;"; } if ($height) { $height = "max-height: {$height}px"; } $nivo_slides = ''; foreach ($slides as $slide) { $nivo_slides .= "<img src='{$slide}' alt='' />"; } $options = boom_nivo_slider_options(); echo "\n\t\t<div class='slider-wrapper theme-default'>\n\t\t\t<div class='ribbon'></div>\n\t\t\t<div style='{$width} {$height}' class='headerSlider nivoSlider'>\n\t\t\t\t{$nivo_slides}\n\t\t\t</div>\n\t\t</div>\n\t\t<script>\n\t\t\tjQuery('div.headerSlider').nivoSlider({\n\t\t\t\t{$options}\n\t\t\t});\n\t\t</script>\n\t"; }
/** * Adds some scripts to the front-page to build the slider images. * This works only if your theme supports WP3.0 Custom Headers, * otherwise you have to use the boom_header_image() template tag. * * @since 0.2 * @return void */ function auto_insert() { if (boom_slider_get_option('autoinsert')) { ?> <script> jQuery(function(a){function b(b){imgs="";a.each(b,function(a,b){imgs+='<img src="'+b+'" alt="" />'});return'<div class="slider-wrapper theme-default"><div class="ribbon"></div><div class="nivoSlider headerSlider">'+imgs+"</div></div>"}var c=<?php echo str_replace("\\/", "/", json_encode(boom_get_header_images())); ?> ,d=a('img[src="http://boom-slider-default"], img[src="http://boom-slider-uploaded"]'),e=d.parent();if(e.is("a")){e.after(b(c)).remove()}else{d.after(b(c)).remove()}var f=a("div.headerSlider");f.find("img:first").load(function(){var b=a(this).width(),c=a(this).height();f.css({maxWidth:b,maxHeight:c}).nivoSlider({<?php echo boom_nivo_slider_options(); ?> })})}) </script> <?php } }