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 Carousel to replace Prev/Next? Reply To: Carousel to replace Prev/Next?

#8999
David Beckwith
Participant

Hi there,

not sure if this will fit your requirements, i am using this PHP snippet to hook in a list of related posts from the current post category:

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

$cat_slug = $cat->slug;
$list = get_page_by_title( 'related', 'OBJECT', 'wp_show_posts' );
wpsp_display( $list->ID, 'tax_term="' . $cat_slug . '"' );
?>

The ‘related’ in $list = get_page_by_title( 'related', 'OBJECT', 'wp_show_posts' ); is the title of the WPSP list.