Adding custom post types to slider


On my site, I have two post types that I want to show on my homepage (‘post’ and ‘event’, filtered by additional categories/tags).

So far, I was using the following code:

if ( ( is_home() || is_feed() || is_category() || is_tag() ) ) {

$post_type = get_query_var('post_type');
if($post_type && $post_type[0] != 'post') {
  $post_type = $post_type;
} else {
  $post_type = array('post','event'); // add custom post types here

(…) add settings for categories/tags here


add_action(‘pre_get_posts’, ‘edit_my_query’);

This worked fine for the past several years, and my pictures would show in the slider where I asked for it.

Now, I am a getting a problem with some other plugin - and the author tells me that I have to add a “ && $query->is_main_query() ” to the opening “if” statement of my query, e.g. “if ( ( is_home() && $query->is_main_query()“

However, if I limit myself to is_main_query, my code seems to not get processed in the slider anymore - and I am not seeing any pictures for my ‘event’ post type.

Is there a way to check that I am in the slider query (something like $query->is_slider_query)? Or, is there some other way for me to get both the ‘post’ and the ‘event’ post types into the slider?

Hi there

My apologies, but we can’t support any customizations its outside of our support policies :frowning:


I’m not looking for support, I am looking for product information

@baylands which product information? please clarify, I will do my best with everything that is under the support rules :slight_smile: