Soliloquy Documentation
Documentation, Reference Materials, and Tutorials for Soliloquy
Documentation, Reference Materials, and Tutorials for Soliloquy
Important: This doc assumes you’re comfortable creating and/or editing PHP files in your WordPress installation and is intended for advanced users.
Note: This document is relevant only if you have a Developer or Master license and you’re using the Featured Content Addon.
You can include a Post’s Custom Fields in the content of your Featured Content slides following this guide.
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-featured-content-display-custom-fields.php
Next, you’ll want to copy and paste the following code into the soliloquy-featured-content-display-custom-fields.php
plugin file you’ve created:
/**
* Append the Post’s Custom Field values onto the end of the content
*
* @param string $pcontent Post Content
* @param WP_Post $post WordPress Post
* @param array $data Slider Data
* @return string $pcontent;
*/
function sol_soliloquy_featured_content_display_custom_fields( $pcontent, $post, $data ) {
// Get custom field values
// If you’re using ACF, you could use get_field( ‘wpcf-case-story-text’, $post->ID )
$text = get_post_meta( $post->ID, ‘wpcf-case-story-text’, true );
$image = get_post_meta( $post->ID, ‘wpcf-case-story-image’, true );
// Append custom field values to the existing content
// Amend as necessary
$pcontent .= $text . $image;
return $pcontent;
}
add_filter( ‘soliloquy_fc_post_content’, ‘sol_soliloquy_featured_content_display_custom_fields’, 10, 3 );[/php]
This example code is not plug-and-play so you’ll need to be sure and edit the code to fit your specific needs.
The last step is to navigate to the WordPress Admin > Plugins screen, locate the plugin named Soliloquy – Featured Content – Display Custom Fields and activate the plugin.
That’s it! You’ve successfully included your Post’s Custom Fields in the content of your Featured Content slider!