Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save n7studios/1af16038c3569f2e048f to your computer and use it in GitHub Desktop.
Save n7studios/1af16038c3569f2e048f to your computer and use it in GitHub Desktop.
Soliloquy - Output 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
*/
/**
* Exclude the Soliloquy CPT from search results
*
* @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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment