Last active
March 27, 2017 16:41
-
-
Save scottpdawson/57144bc69f0f85a1b7215cc016fb98bf to your computer and use it in GitHub Desktop.
This file contains hidden or 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: Gallery */ | |
/** | |
* The Template for displaying gallery cake images. | |
* @package Motif | |
*/ | |
get_header(); ?> | |
<?php | |
// use a nonce: a one-time token to identify future requests to the web site | |
// echo the nonce into the form tag so it can be read on form submission | |
// and verified on the server | |
$nonce = wp_create_nonce("gallery_nonce"); | |
?> | |
<form id="galleryForm" data-nonce="<?php echo $nonce ?>"> | |
<?php | |
// generate select lists | |
global $wpdb; | |
// occasions | |
$occasions = $wpdb->get_results('SELECT id, occasion FROM occasions ORDER BY occasion ASC', ARRAY_N); | |
echo "<select id='occasion' class='gallerySelector'>"; | |
echo "<option value='all'>- All Occasions -</option>"; | |
foreach ($occasions as $occasion) { | |
echo "<option value='{$occasion[0]}'>{$occasion[1]}</option>"; | |
} | |
echo "</select>"; | |
// ... repeat for sizes and colors | |
<button type="submit" href="javascript:void(0)" class="updateGallery">Update</button> | |
</form> | |
<ul class="l-grid galleryGrid clickableImages"></ul> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment