setting up default tabs
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 18 May 2018 17:10:49 +0000 (13:10 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 18 May 2018 17:10:49 +0000 (13:10 -0400)
rooms.php

index beaae4f..8ace70c 100644 (file)
--- a/rooms.php
+++ b/rooms.php
@@ -13,7 +13,6 @@ get_header();
     $slug = $post->post_name;
     $content = apply_filters('the_content', $post->post_content); 
 ?>
-
  <div class="mid-content">
        <div id="primary" class="content-area">
                <main id="main" class="site-main">
@@ -100,14 +99,26 @@ get_header();
         //     active: 1,
         //     heightStyle: "content"
         // });
+        let tab = 0;
+        const slug  = '<?php echo $slug?>';
+        const rooms = jQuery('#rooms-tabs').children('ul').children('li');
+        rooms.each(function(index, value){
+           let room = jQuery(this).children('a').text().toLowerCase()
+           room = room.substr(0, room.indexOf(' ')); 
+            if( slug.indexOf(room) !== -1 && room){
+                tab = jQuery(this).index();
+            }
+        })
+
         jQuery( ".room-amenities" ).accordion({
             collapsible: true,
             active: false,
             heightStyle: "content"
         });
         jQuery( "#rooms-tabs" ).tabs({
-            active: 1
+            active: tab
         });
+        
     });
 </script>
 <?php get_footer();
\ No newline at end of file