Home › Forums › Support › How to Reverse the Post Order of a Specific Category? This topic has 9 replies, 2 voices, and was last updated 1 year, 11 months ago by David. Viewing 10 posts - 1 through 10 (of 10 total) Author Posts December 18, 2018 at 11:39 pm #760860 Jungsu Hello. How can I reverse the post order of a specific category. I hate to use the plugin. Thanks, December 19, 2018 at 5:12 am #761064 DavidStaff Customer Support Hi there, try this function: function change_category_order( $query ) { if ( $query->is_category('8') && $query->is_main_query() ) { $query->set( 'order', 'ASC' ); } } add_action( 'pre_get_posts', 'change_category_order' ); https://docs.generatepress.com/article/adding-php/ Just change the category ID to match your selection. December 19, 2018 at 5:18 am #761068 Jungsu The issue is resolved. Thank you!! December 19, 2018 at 5:18 am #761069 DavidStaff Customer Support You’re welcome June 8, 2021 at 2:44 am #1814470 marc Hi, If I may hijack this thread: how would you apply this to all categories? I tried something like this but it doesn’t work: function change_category_order( $query ) { if ( $query->is_category(‘8’, ‘9’, ’10’) && $query->is_main_query() ) { $query->set( ‘order’, ‘ASC’ ); } } add_action( ‘pre_get_posts’, ‘change_category_order’ ); Thanks in advance, June 8, 2021 at 4:27 am #1814592 DavidStaff Customer Support Hi there, try this: function change_category_order( $query ) { if ( $query->is_category() && $query->is_main_query() ) { $query->set( 'order', 'ASC' ); } } add_action( 'pre_get_posts', 'change_category_order' ); June 8, 2021 at 5:06 am #1814645 marc Thanks David it worked. Is there a way to make a specific post within a specific category featured? I can only see the “make first post featured” option. Thanks, Marc June 8, 2021 at 6:29 am #1814729 DavidStaff Customer Support Theres a plugin that allows you to set a Sticky Post for specific categories: https://wordpress.org/plugins/category-sticky-post/ Its the only way that i know that is possible, but the plugin is out of date, but some users looking at the reviews are still using it…. June 8, 2021 at 7:01 am #1814780 marc Ok thanks for that. June 8, 2021 at 7:03 am #1814784 DavidStaff Customer Support You’re welcome Author Posts Viewing 10 posts - 1 through 10 (of 10 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In