Soliloquy Documentation

Documentation, Reference Materials, and Tutorials for Soliloquy

Add Slide Count to a Slider

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

You can add the slide count to all Soliloquy sliders following this guide.

  1. Create Plugin File
  2. Edit the New Plugin File
  3. Activate the New Plugin
  4. FAQs

Step 1 – Create Plugin File

The first step is to create a new php file in the wp-content/plugins/ directory of your WordPress installation. The easiest way to do this is using your favorite FTP program or through your web hosting account’s file editor (if they provide one).

Once you’ve navigated to the wp-content/plugins/ directory, create a new file with the name soliloquy-slide-count.php

Step 2 – Edit the New Plugin File

Next, you’ll want to copy and paste the following code into the soliloquy-slide-count.php plugin file you’ve created:

<?php
/**
* Plugin Name: Soliloquy - Slide Count
* Plugin URI: https://soliloquywp.com
* Version: 1.0
* Author: Tim Carr
* Author URI: http://www.n7studios.co.uk
* Description: Displays "X of Y" on Soliloquy Slideshows
*/

/**
* Display the number of slides
*
* @param string $html Slider HTML
* @param array $data Slider Data
* @return string HTML
*/
function sol_soliloquy_slide_count( $html, $data ) {

	$html .= '<div class="soliloquy-slide-count" style="margin: 5px 0;text-align:center;">
		<span class="current">1</span>
		' . __( 'of', 'soliloquy' ) . '
		<span class="total">' . count( $data['slider'] ) . '</span>
		' . __( 'slides', 'soliloquy' ) . '
	</div>';

	return $html;
	
}
add_filter( 'soliloquy_output_end', 'sol_soliloquy_slide_count', 10, 2 );

/**
* Update the slide count once transitioned
*/
function sol_soliloquy_slide_count_update( ) {

	?>
	$('span.current', $(element).closest('.soliloquy-container')).text((newIndex + 1));
	<?php
	
}
add_filter( 'soliloquy_api_after_transition', 'sol_soliloquy_slide_count_update' );

Step 3 – Activate the New Plugin

The last step is to navigate to the WordPress Admin > Plugins screen, locate the plugin named Soliloquy – Slide Count and activate the plugin.

That’s it! You’ve successfully added the slide count to your Soliloquy slides!

FAQs

Q: The count goes off if I use thumbnail navigation, why?

A: Currently you can’t use this plugin with the Thumbnails addon as it will throw the count off. You must deactivate the thumbnails for the slider from the Thumbnails tab if you wish to show a slider count.


[i]
[i]