Last active
February 22, 2018 02:54
-
-
Save hborrelli1/e5392f84b9fdc0fdf13a2ab623f4bac2 to your computer and use it in GitHub Desktop.
Show content based on select dropdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* Template Name: West Region Template */ ?> | |
<? get_header(); ?> | |
<?php if ( presscore_is_content_visible() ): ?> | |
<div id="content" class="content" role="main"> | |
<div class="page-header"> | |
<div class="page-header-wrap"> | |
<span class="small-title">BLUE CHAIR BAY RUM</span> | |
<h1 class="main-heading-blue">CUSTOM SALES ORDERING</h1> | |
<div class="titleBar"></div> | |
<p>Here you can request or complete orders of BCBR gift kits to be shipped to a warehouse of your choosing for pickup.</p> | |
<p class="p-border">Continue by selecting your region below.</p> | |
</div> | |
</div> | |
<div class="inventory-section"> | |
<div class="region-select-wrap"> | |
<div class="inventory-section"> | |
<select class="region-select-wrap" id="getComboA" name="stateSelect" onchange="getComboA(this)"> | |
<option class="stateOpt" selected>Select a State</option> | |
<option class="stateOpt" value="California">California</option> | |
<option class="stateOpt" value="Washington">Washington</option> | |
<option class="stateOpt" value="Nevada">Nevada</option> | |
<option class="stateOpt" value="Arizona">Arizona</option> | |
<option class="stateOpt" value="Hawaii">Hawaii</option> | |
<option class="stateOpt" value="Alaska">Alaska</option> | |
</select> | |
</div> | |
</div> | |
<div class="inventory-wrap"> | |
<div class="container"> | |
<div class="half inventory-column-wrap"> | |
<div class="stateInventory active"> | |
<h4 class="inventory-title">Use the dropdown above to show inventory by state.</h4> | |
</div> | |
<div class="stateInventory" id="California"> | |
<h4 class="inventory-title">California's Inventory</h4> | |
<?php echo do_shortcode("[wpinventory category_name='California']"); ?> | |
</div> | |
<div class="stateInventory" id="Washington"> | |
<h4 class="inventory-title">Washington's Inventory</h4> | |
<?php echo do_shortcode("[wpinventory category_name='Washington']"); ?> | |
</div> | |
<div class="stateInventory" id="Nevada"> | |
<h4 class="inventory-title">Nevada's Inventory</h4> | |
<?php echo do_shortcode("[wpinventory category_name='Nevada']"); ?> | |
</div> | |
<div class="stateInventory" id="Arizona"> | |
<h4 class="inventory-title">Arizona's Inventory</h4> | |
<?php echo do_shortcode("[wpinventory category_name='Arizona']"); ?> | |
</div> | |
<div class="stateInventory" id="Hawaii"> | |
<h4 class="inventory-title">Hawaii's Inventory</h4> | |
<?php echo do_shortcode("[wpinventory category_name='Hawaii']"); ?> | |
</div> | |
<div class="stateInventory" id="Alaska"> | |
<h4 class="inventory-title">Alaska's Inventory</h4> | |
<?php echo do_shortcode("[wpinventory category_name='Alaska']"); ?> | |
</div> | |
</div> | |
<div class="half inventory-column-wrap"> | |
<h4 class="inventory-title">West Regions Inventory Inventory</h4> | |
<?php echo do_shortcode("[wpinventory]"); ?> | |
</div> | |
</div> | |
</div> | |
<div class="place-order-btn dark-blue"> | |
<a href="#">PLACE AN ORDER</a> | |
<?php echo do_shortcode('[products]'); ?> | |
</div> | |
</div><!-- end of inventory wrap --> | |
</div> <!-- #content --> | |
<?php do_action( 'presscore_after_content' ) ?> | |
<?php endif // if content visible ?> | |
<?php get_footer() ?> | |
<script> | |
function getComboA(selectObject) { | |
console.log(selectObject); | |
console.log(selectObject.value); | |
for (let el of document.querySelectorAll('.stateInventory')) el.classList.remove("active"); | |
document.getElementById(selectObject.value).classList.toggle("active"); | |
} | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment