function gdlr_print_room_item($settings = array()) { $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" '; global $gdlr_spaces; $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-blog-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : ''; $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : ''; // query posts section $args = array('post_type' => 'room', 'suppress_filters' => false); $args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch']; $args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby']; $args['order'] = empty($settings['order']) ? 'desc' : $settings['order']; $args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1; if (!empty($settings['category']) || !empty($settings['tag'])) { $args['tax_query'] = array('relation' => 'OR'); if (!empty($settings['category'])) { array_push($args['tax_query'], array('terms' => explode(',', $settings['category']), 'taxonomy' => 'room_category', 'field' => 'slug')); } if (!empty($settings['tag'])) { array_push($args['tax_query'], array('terms' => explode(',', $settings['tag']), 'taxonomy' => 'room_tag', 'field' => 'slug')); } } $query = new WP_Query($args); $no_space = strpos($settings['room-style'], 'no-space') > 0 ? 'gdlr-item-no-space' : ''; $settings['room-style'] = str_replace('-no-space', '', $settings['room-style']); if (($settings['room-style'] == 'classic' || $settings['room-style'] == 'modern') && !empty($settings['enable-carousel']) && $settings['enable-carousel'] == 'enable') { $settings['carousel'] = true; } $ret = gdlr_get_item_title($settings); $ret .= '<div class="room-item-wrapper type-' . $settings['room-style'] . '" ' . $item_id . $margin_style . '>'; $ret .= '<div class="room-item-holder ' . $no_space . '">'; if ($settings['room-style'] == 'medium') { global $gdlr_excerpt_length, $gdlr_excerpt_read_more, $gdlr_excerpt_word; $gdlr_excerpt_read_more = false; $gdlr_excerpt_length = $settings['num-excerpt']; add_filter('excerpt_length', 'gdlr_set_excerpt_length'); $ret .= gdlr_get_medium_room($query, $settings['thumbnail-size']); $gdlr_excerpt_word = ''; $gdlr_excerpt_read_more = true; remove_filter('excerpt_length', 'gdlr_set_excerpt_length'); } else { if ($settings['room-style'] == 'classic') { if (!empty($settings['enable-carousel']) && $settings['enable-carousel'] == 'enable') { $ret .= gdlr_get_classic_room_carousel($query, $settings['room-size'], $settings['thumbnail-size']); } else { $ret .= gdlr_get_classic_room($query, $settings['room-size'], $settings['thumbnail-size']); } } else { if ($settings['room-style'] == 'modern') { if (!empty($settings['enable-carousel']) && $settings['enable-carousel'] == 'enable') { $ret .= gdlr_get_modern_room_carousel($query, $settings['room-size'], $settings['thumbnail-size']); } else { $ret .= gdlr_get_modern_room($query, $settings['room-size'], $settings['thumbnail-size']); } } } } $ret .= '<div class="clear"></div>'; $ret .= '</div>'; if ($settings['pagination'] == 'enable') { $ret .= gdlr_get_pagination($query->max_num_pages, $args['paged']); } $ret .= '</div>'; // room-item-wrapper return $ret; }
echo '<div class="room-item-holder" >'; if ($theme_option['archive-room-style'] == 'medium') { global $gdlr_excerpt_length, $gdlr_excerpt_read_more, $gdlr_excerpt_word; $gdlr_excerpt_read_more = false; $gdlr_excerpt_length = $theme_option['archive-room-num-excerpt']; add_filter('excerpt_length', 'gdlr_set_excerpt_length'); echo gdlr_get_medium_room($wp_query, $theme_option['archive-room-thumbnail-size']); $gdlr_excerpt_word = ''; $gdlr_excerpt_read_more = true; remove_filter('excerpt_length', 'gdlr_set_excerpt_length'); } else { if ($theme_option['archive-room-style'] == 'classic') { echo gdlr_get_classic_room($wp_query, $theme_option['archive-room-size'], $theme_option['archive-room-thumbnail-size']); } else { if ($theme_option['archive-room-style'] == 'modern') { echo gdlr_get_modern_room($wp_query, $theme_option['archive-room-size'], $theme_option['archive-room-thumbnail-size']); } } } echo '<div class="clear"></div>'; echo '</div>'; $paged = get_query_var('paged') ? get_query_var('paged') : 1; echo gdlr_get_pagination($wp_query->max_num_pages, $paged); } else { // set the excerpt length if (!empty($theme_option['archive-num-excerpt'])) { global $gdlr_excerpt_length; $gdlr_excerpt_length = $theme_option['archive-num-excerpt']; add_filter('excerpt_length', 'gdlr_set_excerpt_length'); } global $wp_query, $gdlr_post_settings;