Archived topic
Specific category posts archive only to be displayed in reverse order?
3 replies · Started by Chris on November 30, 2019
Apologies first, I’m a designer (not a coder!) slowly transitioning my site over to GP Pro. Hope this is an OK question to ask as a newbie here!
the new 2.0 version of the site will, for me, be a big change from my current Customizr theme version. It will be a combination of GP and Elementor. As part of the new look, one historical section will be a specific Category archive (‘Early Bay’)
I saw this plugin https://wordpress.org/plugins/category-reverse-order/ which sounded ideal but had zero feedback, so I was reluctant to try it.
(just tried it on a staging site and it didn’t seem to play nicely with my configuration…)
This code snippet came up in my searches…
----
function change_category_order( $query ) {
if ( $query->is_category('Early Bay') && $query->is_main_query() ) {
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'change_category_order' );
----
My question is would this be the best way to go with GP, or should I look for a developer to help with some custom CSS?
If it makes any differences, the archive is created with a custom loop with Ele Custom Skin?
Hi there,
That code should work if you are using the default WordPress post loop (this is not a part of the GP theme).
Reversing the order isn't something you can do with CSS unfortunately.
If you are using Elementor to display your post then you will likely need to check with their support.
Also just checked your site and it isn't using GP.
Let me know if this helps :)
Thanks, yes, as I said, I’m slowly migrating a new 2.0 version of the site over to run on GP pro, but that’s still in the final stages of development, hopefully, live shortly!
Sounds good :)