Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function plethora_shortcode_room_amenities( $args, $content = '' ) {
- // Default shortcode arguments
- $args = wp_parse_args( $args, array(
- 'post_id' => is_singular( 'room' ) ? get_the_ID() : false,
- 'limit' => 5
- ));
- if ( $args['post_id'] ) {
- $room_obj = Plethora_Theme::get_feature_instance( 'posttype', 'room' );
- $amenities = method_exists( $room_obj, 'get_room_amenities' ) ? $room_obj::get_room_amenities( $args['post_id'], $args['limit'] ) : false;
- if ( $amenities ) {
- ?>
- <div class="room_single_amenities">
- <?php foreach ( $amenities as $amenity ) { ?>
- <div class="text-center item">
- <div class="row">
- <?php switch ( $amenity['icon_type'] ) {
- case 'library_icon': // markup for font icons
- default:
- ?>
- <i data-toggle="tooltip" data-placement="top" class="<?php echo esc_attr( $amenity['icon_class'] ); ?>" data-original-title="<?php echo esc_attr( $amenity['desc'] ); ?>"></i>
- <span><?php echo wp_kses( $amenity['title'], Plethora_Theme::allowed_html_for( 'heading' ) ); ?></span>
- <?php
- break;
- case 'custom_icon': // markup for image icons
- ?>
- <img src="<?php echo esc_url( $amenity['icon_url'] ); ?>" data-toggle="tooltip" data-placement="top" class="<?php echo esc_attr( $amenity['icon_class'] ); ?>" data-original-title="<?php echo esc_attr( $amenity['desc'] ); ?>"/>
- <span><?php echo wp_kses( $amenity['title'], Plethora_Theme::allowed_html_for( 'heading' ) ); ?></span>
- <?php
- break;
- } ?>
- </div>
- </div>
- <?php }
- }
- ?>
- </div>
- <?php
- }
- }
- add_shortcode( 'ple_amenities', 'plethora_shortcode_room_amenities' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement