How to extract which post type each slide is from?

Pending 1 posts from 2 participants
  • Started 5 years, 1 month ago ago by Amanda
  • Replied 5 years, 1 month ago ago by Constantin
Viewing 2 posts - 1 through 2 (of 2 total)
  • #2246


    I’ve got a slideshow of several different custom post types, this works well, but is there a way to extract the info into each slide as to which post type that specific slide is from? I don’t see that in any of your functions. Specifically, I need to add a button to each slide that takes you to the category landing page that goes with the custom post type, not just the ‘read more’ button that goes to the specific post. For example “more deals” or “more events”

    Also, is there a way to sort them that is not just random or by date? Specifically I have 5 posts from 5 different custom post types, and I need them to stay in the same order of post type even when the specific post changes. thank you!




    To get the current post slide object, while in slides loop, you can use plugin function get_current_slide(). After getting the current post, it’s just a matter of accessing its post type like you do with any post in WordPress.

    while( have_slides() ){
        $slide_obj = get_current_slide();
        $post_type = $slide_obj->post_type;

    Regarding the sorting, I don’t quite get it. What exactly do you need: sort posts by post type and publish date?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.