How-To Get posts with image & from specific Author at first of is_tax() page
-
Hello,
How can i do to have the post first result > Get Thumbnails && Author is not Admin
I did a first ‘pre_get_posts’ to have the none “default Thumbnails” on first results :
function filter_visite_with_image($query) { if ( is_admin() || ! $query->is_main_query() ) return; if ( is_home() || is_tax() ){ $query->set( 'meta_key', '_thumbnail_id' ); $query->set( 'orderby', '_thumbnail_id' ); $query->set( 'order', 'ASC' ); return $query; } } add_filter( 'pre_get_posts', 'filter_visite_with_image' );
Maybe it’s not really code friendly but did the job.
But now, i want to have the ‘non-admin author’ first keeping the image filter…Maybe be i can use this tutoriel : Modify Query based on Post Meta
But i don’t really know how to mix my old ‘pre_get_posts’ and this new tips.
Tell me if it’s not clear… (Damned Frenchy !)
Thanks for help
See you
- The topic ‘How-To Get posts with image & from specific Author at first of is_tax() page’ is closed to new replies.