Additional Fields for Soliloquy Images

So… I was asked to convert an HTML template into a a WordPress page template, and it has two sliders. A friend of mine recommended me to use Soliloquy, which is a very nice plugin. However, since I didn’t want to mess with the markup and styling, I opted to only use Soliloquy’s backend.

Now, the markup contains an additional text which is not suitable for the existing image fields (title, alt, caption, etc), so I needed to add an additional field to the image meta frame, and here’s how I did it:

 * Add extra custom fields to slideshow images
function _my_soliloquy_slide_source_field( $id, $data, $post_id ) {
	$source = ! empty( $data['source'] ) ? $data['source'] : '';
		<tr id="soliloquy-source-box-<?php echo esc_attr( $id ) ?>" valign="middle">
			<th scope="row"><label for="soliloquy-source-<?php echo esc_attr( $id ) ?>"><?php _e( 'Source', 'mytheme' ); ?></label></th>
				<input id="soliloquy-source-<?php echo esc_attr( $id ) ?>" class="soliloquy-source" type="text" name="_soliloquy[meta_source]" value="<?php echo esc_attr( $source ); ?>" data-soliloquy-meta="source" />
add_action( 'soliloquy_after_image_meta_settings', '_my_soliloquy_slide_source_field', 1, 3 );

 * Save slideshow images's extra custom fields
function _my_soliloquy_ajax_save_meta( $slider_data, $meta, $attach_id, $post_id ) {
	if ( ! empty( $meta['source'] ) ) {
		$slider_data['slider'][ $attach_id ]['source'] = sanitize_text_field( $meta['source'] );
	else {
		unset( $slider_data['slider'][ $attach_id ]['source'] );

	return $slider_data;
add_action( 'soliloquy_ajax_save_meta', '_my_soliloquy_ajax_save_meta', 10, 4 );

_sol_slider_data now contains the source field’s value.



  1. Tre says:

    You said you only use the backend! Could you give us more details about how to hack the soliloquy to only use the backend? Myself I still don’t want to use soliloquy display future, but I love the backend.