Related Posts
…display a set of posts with the default settings. relevanssi_the_related_posts( $post->ID ); // Then add a filter to adjust the settings on the fly. add_filter( ‘pre_option_relevanssi_related_settings’, function( $value ) { if ( empty( $value ) ) { // $value is empty by default, so get the settings from the database….…show a single set of related posts. However, it’s possible to get around this restriction, but it requires some work. The trick is first to display a set of related posts based on the plugin settings, then adjust the settings on the fly and then generate another set. To get……in the template: // First display a set of posts with the default settings. relevanssi_the_related_posts( $post->ID ); global $doing_second_related_posts; $doing_second_related_posts = true; // Get the post objects with the new settings. relevanssi_the_related_posts( $post->ID ); // This can be in theme functions.php: // Add a filter to adjust the settings on…