Soliloquy Documentation

Documentation, Reference Materials, and Tutorials for Soliloquy

Featured Content: Appending Custom Slides

Important: This doc assumes you’re comfortable creating and/or editing PHP files in your WordPress installation and is intended for advanced users.

Note: This document is relevant only if you have a Developer or Master license and you’re using the Featured Content Addon.

We were asked the following question:

I’ve got the Featured Content Addon installed, is there a way to show featured content PLUS a static slide or two? I have a custom taxonomy (tours) and I want to display all the posts in that (I think there’s 4 altogether) plus 2 other slides that link to pages – can I do this with Soliloquy?

And the answer is yes! Soliloquy comes with lots of hooks and filters to modify the output of your slider, and in this case, the soliloquy_pre_data filter is just what we need.

Use the code below to append a custom slide to your slider. You can change out the image, alt text, title and caption information to whatever you would like it to be. Feel free to add or remove things as needed!

Add the following code to your active theme’s functions.php file and modify as you require:

function sol_soliloquy_inject_slides( $data, $slider_id ) {
	
	// Only apply to slider slug my-slug
       if ( $data['config']['slug'] != 'my-slug' ){
             return $data;
 	}	
	
        // Inject Image Slide
	$data['slider']['custom-1000'] = array(
		'id' => 'custom-1000',
		'status'=> 'active',
		'src'	=> 'http://placehold.it/900x900.jpg',
		'title' => 'Custom Image Slide',
		'link' 	=> 'https://soliloquywp.com',
		'alt' 	=> 'Placeholder Image Alternate Description',
		'caption'=> 'Placeholder Caption',
	);
	
	return $data;

}
add_filter( 'soliloquy_pre_data', 'sol_soliloquy_inject_slides', 10, 2 );
[i]
[i]