Category order (& remove by/date/reply)
Perfect responsive WordPress theme to showcase your mobile, iPad or tablet apps.
- GK User
- Wed Sep 30, 2015 12:26 pm
Hi
I'm actually using BluAp for a B&B (holiday accommodation) website, and I've created a category 'rooms' that comprises mostly photographs of the rooms.
I entered them best-room-first, so I've ended up that the latest is the 'worst' room, and that's at the top of the listing, so I need to re-order this category, how do I do that? I've been to the category setup page and that doesn't seem to provide much at all. Of course, I could re-enter the rooms but I'd rather not, computers are supposed to help, not hinder
And then (I could do it with css, but just in case I can switch it off easily), I could do with getting rid of that whole:
Published in: Rooms September 18, 2015 Written by admin Leave a reply
line. How?
Thanks in advance
Cheers
J
I'm actually using BluAp for a B&B (holiday accommodation) website, and I've created a category 'rooms' that comprises mostly photographs of the rooms.
I entered them best-room-first, so I've ended up that the latest is the 'worst' room, and that's at the top of the listing, so I need to re-order this category, how do I do that? I've been to the category setup page and that doesn't seem to provide much at all. Of course, I could re-enter the rooms but I'd rather not, computers are supposed to help, not hinder
And then (I could do it with css, but just in case I can switch it off easily), I could do with getting rid of that whole:
Published in: Rooms September 18, 2015 Written by admin Leave a reply
line. How?
Thanks in advance
Cheers
J
-
- Fresh Boarder
- GK User
- Wed Sep 30, 2015 3:01 pm
Could you please provide me with a URL to your website, either here or via PM (click the “Private Message” text underneath my avatar) so that I may analyze it?
Regarding the order - you have to modify the loop from Bluap/category.php file, please check i.e. this article:
http://www.remicorson.com/modifying-the ... get_posts/
Regarding the order - you have to modify the loop from Bluap/category.php file, please check i.e. this article:
http://www.remicorson.com/modifying-the ... get_posts/
-
- Moderator
- GK User
- Fri Oct 09, 2015 10:19 am
OK, so I'm getting to add
<?php
// from http://www.remicorson.com/modifying-the ... get_posts/
// Load our function when hook is set
add_action( 'pre_get_posts', 'modify_query_get_rooms' );
function modify_query_get_rooms( $query ) {
// Check if on frontend and main query is modified
if( ! is_admin() && $query->is_main_query() && $query->query_vars['category_name'] != 'rooms' ) {
$query->set( 'order', 'DESC' );
}
}
?>
Question is: where to add it?
I was guessing category.php, but if I modify it in wordpress edit, I'm editing the main file aren't I, so it'll get overridden by an update.
Also where, in the file, to add that code? For instance, before or after
gk_load('header');
gk_load('before');
?
<?php
// from http://www.remicorson.com/modifying-the ... get_posts/
// Load our function when hook is set
add_action( 'pre_get_posts', 'modify_query_get_rooms' );
function modify_query_get_rooms( $query ) {
// Check if on frontend and main query is modified
if( ! is_admin() && $query->is_main_query() && $query->query_vars['category_name'] != 'rooms' ) {
$query->set( 'order', 'DESC' );
}
}
?>
Question is: where to add it?
I was guessing category.php, but if I modify it in wordpress edit, I'm editing the main file aren't I, so it'll get overridden by an update.
Also where, in the file, to add that code? For instance, before or after
gk_load('header');
gk_load('before');
?
-
- Fresh Boarder
- GK User
- Fri Oct 09, 2015 6:13 pm
This function should be added i.e. to Bluap/gavern/user.functions.php file, yes this file will be overriden during the udpate (if you'll update entire directory), so you should use Child Theme:
https://www.gavick.com/documentation/wo ... ild-themes
Maybe it will be easier to use i.e. this plugin:
https://wordpress.org/plugins/taxonomy-terms-order/
https://www.gavick.com/documentation/wo ... ild-themes
Maybe it will be easier to use i.e. this plugin:
https://wordpress.org/plugins/taxonomy-terms-order/
-
- Moderator
- GK User
- Sat Oct 10, 2015 8:31 am
Dammit .. much as it frustrates me when I am dealt with in such a way, in this case, the answer was simply that the widget that displays the rooms provides a sort choice. Note to self, check the simple stuff first.
-
- Fresh Boarder
5 posts
• Page 1 of 1