We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Automatic filter on current post's category Reply To: Automatic filter on current post's category

#3806
Tom
Keymaster

Hi there,

You can add custom parameters to the shortcode, like this:

<?php
if ( is_single() ) {
    $cats =  get_the_category();
    $cat = $cats[0];
} else {
    $cat = get_category( get_query_var( 'cat' ) );
}

$cat_slug = $cat->slug;

wpsp_display( 1, 'tax_term="' . $cat_slug . '"' );
?>

That will only show posts from the same category which is currently being viewed.