• daddyke

    (@daddyke)


    Hi,

    I’d like to ask how to change the
    1. hotel rooms list order. It is loaded by this shortcode: [hotel_booking_rooms]
    2. after clicking hotel booking search, the rooms list suitable for the booking date interval, loaded with [hotel_booking] shortcode

    Now 1. lists the rooms in ID order descending, and 2. in ID order ascending. I want both descending, besides I’d like to know where can I set them by myself.

    I use the Hotel WP theme.

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Thoa Kim

    (@thoakim)

    Hi

    1. You can override the file archive-rooms.php in wp-hotel-booking\templates

    2. Override the files in wp-hotel-booking\templates\search

    Thread Starter daddyke

    (@daddyke)

    Hi,

    thanks, but they are obviously already overwritten.
    My question is where and how to set the list order based on IDs ascending and descending.
    Which file which line what code sould I use?

    Thank you.

    Plugin Contributor Thoa Kim

    (@thoakim)

    You mean the theme override those files? If so, you should contact the theme author to know where the files are located.

    It’s related to programming knowledge so that we’re not able to guide you single line codes. Just review the code in those files then we will know how to customize it.

    jasonchuah4

    (@jasonchuah4)

    I think what daddyke means is to sort the room ID either by ascending or descending. You can take a look at wp-hotel-booking > includes > shortcodes > class-wphb-shortcode-hotel-booking-rooms.php and look this piece of code

    		$args = array(
    			'post_type'      => 'hb_room',
    			'posts_per_page' => $atts['number_room'],
    			'orderby'        => 'date',
    			'order'          => 'DESC',
    			'post_status'    => 'publish'
    		);

    Here you can change your orderby and order. But bear in mind, always make a backup of this file before you make any amendments. And any future update in this plugin might overwrite your changes. So you might want to disable auto-update for this plugin.

    For your 2nd query on search room ID desc order I’ve no idea on that.

    Thread Starter daddyke

    (@daddyke)

    Thanks jasonchuah4 your answer. I’m looking for only the Hotel Booking Search page order. I found this in the hotel-wp/wp-hotel-booking/search/list.php

    <ul class="hb-search-results">
    	<?php
    	foreach ( $results as $room ) {
    		hb_get_template( 'search/loop.php', array( 'room' => $room, 'atts' => $atts ) );
    	}
    	?>
    </ul>

    There is $atts also like in the file you suggested:

    $atts = shortcode_atts( array(
    			'room_type'   => '',
    			'orderby'     => 'title',
    			'order'       => 'ASC',
    			'number_room' => - 1,
    			'room_in'     => '',
    			'room_not_in' => '',
    		), $atts );

    But this has effect only on the room listing page. But maybe I have to look at this kind of settings around search files.

    Thanks again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP Hotel Booking rooms and bookable rooms list order’ is closed to new replies.