Soliloquy Documentation
Documentation, Reference Materials, and Tutorials for Soliloquy
Documentation, Reference Materials, and Tutorials for Soliloquy
Would you like to exclude current post from Featured Content sliders? If you’ve added a Featured Content slider to your post but don’t want the current post to display in the slider, just follow the directions below and we’ll help you with that!
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 exclude the current post from Featured Content sliders, we’ll need to create and upload a basic WordPress plugin.
To the current post from your Featured Content sliders, just add the following code to a new file at wp-content/plugins/soliloquy-fc-exclude-current-post.php
.
function sol_soliloquy_fc_exclude_current_post( $query_args, $id, $data ) {
if( is_singular() && !isset( $args[‘post__in’] ) )
$args[‘post__not_in’] = array( get_the_ID() );
return $args;
}
add_filter( ‘soliloquy_fc_query_args’, ‘sol_soliloquy_fc_exclude_current_post’, 10, 3 );[/php]
If you’re unsure how to create a plugin file, follow these steps below:
soliloquy-fc-exclude-current-post.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 – Featured Content – Exclude Current Post plugin.
And that’s it! Would you like to add the author and category to your Featured Content slider? Have a look at our tutorial on How to Display Date, Author and Categories.