Soliloquy Documentation
Documentation, Reference Materials, and Tutorials for Soliloquy
Documentation, Reference Materials, and Tutorials for Soliloquy
Would you like your slider to display the image title before the caption? We can definitely help you with that! We’ll walk you through how to show you image title before your caption and give you some styling tips as well!
Note: This tutorial is a bit more technical than our other docs, but we’ll walk you through the process step by step. In order to show the slide title before the caption, we’ll need to create and upload a basic WordPress plugin.
To set the image title before your captions, just add the following code to a new file at wp-content/plugins/soliloquy-display-title-before-caption.php
.
add_filter( ‘soliloquy_output_caption’, ‘sol_soliloquy_title_before_caption’, 10, 5 );
function sol_soliloquy_title_before_caption( $caption, $id, $slide, $data, $i ) {
// Check if current slide has a title specified
if ( isset( $slide[‘title’] ) && !empty( $slide[‘title’] ) ) {
$caption = ‘<h4 class="title">’ . $slide[‘title’] . ‘</h4>’;
$caption .= ‘<div class="caption">’ . $slide[‘caption’] . ‘</div>’;
}
return $caption;
}[/php]
We’re going to tell Soliloquy to output the title in a h4
tag just before the caption text, and add some CSS to style it.
If you’re unsure how to create a plugin file, follow these steps below:
soliloquy-display-title-before-caption.php
Your next step is to activate the plugin you just uploaded. Simply navigate to the Plugins from within your WordPress dashboard and activate the Soliloquy – Display Slide Title Before plugin.
Finally, we’ll use CSS to style the slide title. Use the following CSS to get started and customize to fit your specific needs.
Add the following CSS to your active theme’s style.css
file:
.soliloquy-caption span.caption {
text-align: center;
}[/css]
With the CSS above, we can now show the title before the caption
That’s it, you now have a beautifully styled slider with a titled caption!
Would you like to check out some of our other styling tutorials? Have a look at our complete list of Styling documentation.