function super_sticky_posts_filter($query) { if ($query->is_main_query() && $query->is_home() && !$query->get('suppress_filters') && super_sticky_filter('home')) { $super_sticky_post_types = super_sticky_post_types(); if (!empty($super_sticky_post_types)) { $post_types = array(); $query_post_type = $query->get('post_type'); if (empty($query_post_type)) { $post_types[] = 'post'; } elseif (is_string($query_post_type)) { $post_types[] = $query_post_type; } elseif (is_array($query_post_type)) { $post_types = $query_post_type; } else { return; // Unexpected value } $post_types = array_merge($post_types, $super_sticky_post_types); $query->set('post_type', $post_types); } } }
function super_sticky_posts_filter($query) { if ($query->is_home && !$query->get('suppress_filters')) { if (super_sticky_filter('home')) { $query->set('post_type', super_sticky_post_types(true)); } else { $query->set('post_type', 'post'); } } return $query; }