How can I make a custom post type sticky?
Your code runs only on post type archive pages. Unless your home page is a post type archive (doubtful) this code won’t run. Change this: if ( is_main_query() && is_post_type_archive() ) { To this: if ( is_main_query() ) { And see what happens. The code will execute on every main query — every page–, including … Read more