ericakfranz
1/14/2015 - 8:05 PM

Add custom Slider Item attributes

Add custom Slider Item attributes

<?php
/**
* Plugin Name: Soliloquy - Output Custom Slider Item Attributes
* Plugin URI: http://soliloquywp.com
* Version: 1.0
* Author: Tim Carr
* Author URI: http://www.n7studios.co.uk
* Description: Add custom HTML attributes to Soliloquy Slider <img> elements
*/

/**
* @param string $attributes 	Image HTML attributes
* @param int|string $id 	The ID for the slide.
* @param array $item    	Array of data for the slide.
* @param array $data    	Array of data for the slider.
* @param int $i         	The number of the slide in the slider.
* @return string 		Image HTML attributes
*/
function soliloquy_output_custom_slider_attributes( $attributes, $id, $item, $data, $i ) {
	
	$attributes .= ' crossorigin="anonymous"'; // Change this to the attributes you want to add
	
	return $attributes;
	
}
add_filter( 'soliloquy_output_image_attr', 'soliloquy_output_custom_slider_attributes', 10, 5 );