Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

[Resolved] Carousel to replace Prev/Next?

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Carousel to replace Prev/Next?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #8915
    Callista
    Participant

    Hi Tom,
    Last question for a while, hopefully! I was thinking it would be great to replace the previous/next links at the bottom of my posts with a carousel that shows all the posts in that post’s category, going forward and backward in a loop, with the current post in the middle (but ideally hidden, because you’re already on that post). Is that even possible? Well, displaying ALL the posts might be a bit overkill, so maybe the previous 5 and next 5? Can we make what posts are displayed relative to the current post? If not, that’s fine, I can just stick with the previous/next links I currently have.
    Thanks again!
    Have a great day!
    Callista

    #8940
    Tom
    Keymaster

    Hi there,

    As of right now, it’s not possible to tell WPSP to display posts within the current category without using PHP. However, this is an option I’d like to add ASAP.

    #8950
    Callista
    Participant

    Hi Tom,
    Yep! I’ve got the php going so it displays the posts in the same category – I found that in another thread. However, it always displays the same 10 or so posts every time, starting from the most recent. I’m wondering if it’s possible to have the posts displayed relative to the current post? Like the previous 5 and the next 5 posts?
    Not a problem if it’s not – just would be a “nice to have” sort of feature.
    Thanks!
    Callista

    #8980
    Tom
    Keymaster

    Hmm, not sure if that’s possible. We could make it so they’re randomly ordered, though?

    Let me know 🙂

    #8989
    Callista
    Participant

    Hi Tom,
    Yeah, I didn’t think so but it doesn’t hurt to ask, right? 🙂
    For now, I will take your suggestion of ordering the posts randomly (option in the settings page).
    Thanks so much!
    Callista

    #8997
    Tom
    Keymaster

    No problem! 🙂

    #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.

    #9095
    Callista
    Participant

    Hi David!
    Thanks for this. Is this different than the random posts option? How is it determining what posts are related? (I see that ‘related’ is the title of the WPSP list – do you mean that you title the WPSP list ‘related’ or do you change the code to reflect the title of the list? And, is your WPSP list pulling all/random posts, or are you somehow specifying which posts are ‘related’?)
    I’m super interested in generating related posts, especially since I tried using JetPack’s version but could not figure out how to get it to display the way I wanted.
    Thanks again!
    Callista

    #9101
    David Beckwith
    Participant

    I am using it here in this upcoming GP Site:

    https://merch.assemblewp.com/plugins/

    The list is hooked into the bottom of the single post.
    It gets the first category of the post you are currently viewing. It then filters the list using that category. So the relationship is by Category.

    The list itself you can configure anyhow you want, just leave out the taxonomy filter, but the name of the list must match that in the code. In my case that is ‘related’

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.