Home › Forums › Pro Support › Carousel to replace Prev/Next? › Reply To: Carousel to replace Prev/Next?
April 25, 2019 at 4:29 pm
#8999
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.