Soliloquy Documentation

Documentation, Reference Materials, and Tutorials for Soliloquy

Automatically Wrap Caption Text in Paragraph Tags

Would you like to wrap caption text in paragraph tags? We can walk you through each step on how to do this! Follow the tutorial below to wrap your Soliloquy captions in paragraph tags.

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 automatically wrap caption text in paragraph tags, we’ll need to create and upload a basic WordPress plugin.


Creating the Plugin

To automatically wrap your Soliloquy captions in paragraph tags, just add the following code to a new file at wp-content/plugins/soliloquy-wrap-caption.php.

add_filter( 'soliloquy_output_item_data', 'ekf_filter_caption_paragraph_tags', 10, 3 );
function ekf_filter_caption_paragraph_tags( $image, $id, $data) {
	
	// Wrap the image caption text in paragraph tags
        $image['caption'] = wpautop( $image['caption'] );
	
	// Return the modified data.
	return $image;
	
}

If you’re unsure how to create a plugin file, follow these steps below:

  1. Open a text file and make sure that it is a plain text document. You can use a plain text editor like Notepad or a code editor of your choice.
  2. Next, copy and paste the code shown above into the file and save the file as soliloquy-wrap-caption.php
  3. Once you’ve saved the file you can easily upload this directly to your /plugins directory on your server using FTP or you can right-click on the text document and zip (or compress).
  4. Finally, log in to your WordPress dashboard and go to Plugins » Add New » Upload Plugin and upload the .zip file you just created in the previous step.

Activate the Plugin

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 – Wrap caption in p tags plugin.

Activate the custom plugin to automatically wrap captions in paragraph tags

And that’s it! Would you like to customize the Soliloquy caption further? Have a look at our documentation on How to Display the Slide Title Before Caption.

[i]
[i]