Home Forums Weaver Show Posts & Show Sliders Can I show custom post types and standard post types in the same slider?

This topic contains 7 replies, has 4 voices, and was last updated by  tanyathib 8 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #18103

    Kimmer99
    Participant

    Here’s the test site: http://sandbox.bnaitikvah.org/

    I have two sliders side by side, one showing images (from posts), the other showing content from posts (if there’s a way to format this with only one slider would love to hear that too). They both use the same filter.
    I use the Timely calendar on this site. It creates a custom post type called, “ai1ec_event” I use the Post Type in the Filter to display these posts. The Timely plugin also provides for custom taxonomies “event_categories”, which I also use to display these events so the slide show displays any of these events with the event_categories equal to “social”.
    However, in addition to these custom posts, I would like to display any standard posts within this slider too. So now I have my post type defined as “post_type=ai1ec_event,post”. However, no standard posts rotate through the slider.

    If I remove the custom taxonomy for the custom post type, then I do get all the standard posts in addition to the custom post type.  So it appears, the custom taxonomy is being applied to the standard post query although it’s not relevant. Furthermore, if I add a category (which should only apply to the standard post type), I don’t get any of the custom post type (since it doesn’t use the standard post categories).
    Is it not possible to show some of the custom posts and some of the standard posts based upon their own specific taxonomies within the same slider?
    Thanks for the help.
    #23791

    scrambler
    Moderator

    1- regarding your question on the 2 sliders versus one

    There is probably a way to use a single slider and use custom CSS to format the content the way you want, but if it works this way, the question is, is it worth the effort.
    If there are issues with the way you are doing it now, we can give it a try, you would need to be specific about what you want to change from the regular post display with featured image on the left and text on the side.

    2- Regarding being able to have both post type and regular posts in the same slider, each filtered with a specific taxonomy and category, I think I reproduced the problem, and need to ask weaver if it is a bug or a limitation.

    @weaver, here is the issue at hand with the Show Post filters (bear with me it is a bit complicated)

    In The Show Posts > FIlter > Custom Taxonomy option section you mention: “Separate different taxonomy lists with a space. Important: Be sure to include the corresponding custom post type in the “Post Type” section that matches the custom taxonomy. ” 

    I understand by that, that you can select different post types in a filter AND different taxonomy for each of them. So for example if I have two post types

    Post_type1  with the taxonomy  type1_taxo   and the taxonomy value type1_taxo_value1

    Post_type2  with the taxonomy  type2_taxo   and the taxonomy value type2_taxo_value1

    Then I should be able to include both post type in the filter with:  post_type=Post_type1,Post_type2

    And only use the respective taxonomies with:  type1_taxo=type1_taxo_value1 type2taxo=type2_taxo_value1

    But that does not seem to work. If I have only one taxonomy list it filters appropriately the corresponding post type, but if I put two taxonomy lists (like above) for two different post types, it returns no posts.

    So are we supposed to be able to have more than one taxonomy list for different post types, or only for a single post type?

    The test I made is the one the OP mentioned and is to use

    post_type=Post_type1,post

    To select both regular post type and custom post type post_type1 (that part works)

    Then attempt to only include one taxonomy (type1_taxo_value1) of the custom post type and one category of the regular post (postcategory1)with

     type1_taxo=type1_taxo_value1 category_name=postcategory1

    And that returns no posts at all.

    It looks like if you use two taxonomy lists, it filters attempting to find both on each post type

    #23792

    Kimmer99
    Participant

    Thanks Scrambler. I’m just going to leave the formatting as is for now regarding two side-by-side sliders as it does seem to work.

    Looking forward to what weaver has to say versus the 2nd issue (bug vs limitation).
    #23793

    Weaver
    Keymaster

    I’m pretty sure this is a limitation as the full query to WP of different taxonomies would require logical operators, and to be passed in via a PHP array. The short code doesn’t do that as it would require a complicated parser to do that right.

    Almost any valid WP_Query can be generated by building a custom filter. The final set of posts to display selection can be filtered:

    $ourposts = new WP_Query(apply_filters(‘atw_show_posts_wp_query’,$qargs, $args));

    Building this filter requires an in depth understanding of how WP_Query works, as well as PHP understanding.

    Such a filter could be included as a Weaver Xtreme Plus Actions and Filters filter.

    As a hint for understanding just what the $qargs and $args values are, I would suggest using the PHP function print_r() to see just what gets passed in to the filter.

    Another hint: the $args array is built from the arugments provided to the [show_posts] short code, so one could make a “fake” argument so that the filter could detect that the custom filter should be applied.
    For example, one could use [show_posts custom_filter=my_filter_1] and then test the $args value to the filter for that value, and simply build the entire WP_Query array in the filter, and return that array.

    But, this is advanced programming, and is provided as a capability to someone capable of building such a filter, and we really can’t provide the advanced support to implement the filter.

    IF one has the proper understanding of WP_Query, it isn’t hard to build a custom filter, but getting that understanding is anything but trivial.

    #23794

    Kimmer99
    Participant

    Thanks Weaver, that’s what I feared. We’re going to go a different route.

    #58120

    tanyathib
    Participant

    Seeing as this post was from over 3 years ago… I’m just wondering if there’s been any updates that will allow the above to be configured within the plugin yet? When I define these settings, the slider returns no results.

    Post Type:
    post_type=Post_type1,post

    Categories:
    category_name=cat1

    Custom Taxonomies:
    custom_category=cat2

    Or is still necessary to generate a custom WP_Query?

    #58121

    Weaver
    Keymaster

    I don’t remember adding anything new to support this, so I doubt it.

    #58184

    tanyathib
    Participant

    No problem, thanks for confirming.

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

You must be logged in to reply to this topic.