Soliloquy Documentation
Documentation, Reference Materials, and Tutorials for Soliloquy
Documentation, Reference Materials, and Tutorials for Soliloquy
Would you like to white label Soliloquy? You can easily do this by installing a custom plugin on your site! Simply create a plugin file to change all instances of “Soliloquy” to simply say “Slider” and remove the Soliloquy banner and branding.
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 create the custom query for the Featured Content slider, we’ll need to create and upload a basic WordPress plugin.
To create this custom query filter, just add the following code to a new file at wp-content/plugins/soliloquy-featured-content-custom-filter.php
.
/**
* Add Author Arguments to Featured Content Queries
*
* @param string $html HTML Link
* @param obj $post WP_Post
* @param array $data Slider Configuration
* @return string HTML Link
*/
function sol_soliloquy_fc_custom_author( $query_args, $id, $data ) {
// You could check for a specific slider slug here, if you only want
// to amend your FC query on a single slider.
if ( $data[‘config’][‘slug’] != ‘my-slug’ ){
return $query_args;
}
// $query_args is an array for WP_Query:
// http://codex.wordpress.org/Class_Reference/WP_Query
$query_args[‘author__in’] = array( 1, 2 ); // Only get Posts that belong to User IDs 1 or 2
// Return query arguments
return $query_args;
}
add_filter( ‘soliloquy_fc_query_args’, ‘sol_soliloquy_fc_custom_author’, 10, 3 );[/php]
If you’re unsure how to create a plugin file, follow these steps below:
soliloquy-featured-content-custom-filter.php
Note: It’s important to make sure you’ve set your slider slug name inside the plugin on line 23. Just replace the 'my-slug'
with the slug name of your slider. You’ll also need to change the ID for the author on line 28 for the array( 1, 2 );
to match the ID of the author(s) you want to include.
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 – Custom Queries – Author plugin.
That’s it! You’ve successfully filtered your Featured Content slides by Author!
Would you like to customize Soliloquy further? Have a look at our tutorial on How to Set a Default Caption.
A: Absolutely! This array of parameters is formatted for WP_Query. You can review their documentation on any other filters you would like. Below is an example of using Custom Fields for your query.
[php]<?php/**
* Add Custom Field Arguments to Featured Content Queries
*
* @param string $html HTML Link
* @param obj $post WP_Post
* @param array $data Slider Configuration
* @return string HTML Link
*/
function sol_soliloquy_fc_custom_fields( $query_args, $id, $data ) {
// You could check for a specific slider ID here, if you only want
// to amend your FC query on a single slider.
if ( 29 == $id ) {
return $query_args;
}
// $query_args is an array for WP_Query:
// http://codex.wordpress.org/Class_Reference/WP_Query
// Check if Featured Content has already set some Custom Field arguments
// If not, set the meta (custom field) query as an array
// This prevents us overwriting any existing arguments that may exist
if ( ! is_array( $query_args[‘meta_query’] ) ) {
$query_args[‘meta_query’] = array();
}
// Only get Posts that have a custom field name of ‘test’ equal to a value of ‘1’
// See https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters for full parameters
$query_args[‘meta_query’][] = array(
‘key’ => ‘test’,
‘value’ => ‘1’,
);
// Return query arguments
return $query_args;
}
add_filter( ‘soliloquy_fc_query_args’, ‘sol_soliloquy_fc_custom_fields’, 10, 3 );[/php]
Just remember to change the if ( 29 == $id ) {
to match the ID of the slider you’re wanting to use this for.
A: This could be a caching issue. You can edit the page and click Update to flush out the cache.