Skip to content

Instantly share code, notes, and snippets.

@neverything
Last active December 11, 2015 18:28
Show Gist options
  • Save neverything/4641594 to your computer and use it in GitHub Desktop.
Save neverything/4641594 to your computer and use it in GitHub Desktop.
Render a page from the main navigation as a Reveal window in your required+ Foundation child theme.
/**
* Here goes all the JS Code you need in your child theme buddy!
*/
(function($) {
// Find the ID on the menu item you want reveal to open with
$("#menu-item-342").click( function( event ) {
event.preventDefault();
// The ID of our freshly creafted modal window content
$("#page-to-modal-317").reveal();
});
}(jQuery));
<?php
/**
* Add page content as Reveal modal
*
* Render page content as a Reveal modal
* window and put it out just above the
* closing </body> tag, as Foundation
* recommends.
*
* @link http://foundation.zurb.com/docs/reveal.php
*/
function required_page_content_reveal() {
$page_id = 317; // Change this to your page ID
$page_data = get_page( $page_id );
if ( $page_data ) : ?>
<div id="page-to-modal-<?php echo $page_data->ID; ?>" class="reveal-modal">
<h2><?php echo $page_data->post_title; ?></h2>
<?php echo apply_filters('the_content', $page_data->post_content); ?>
<a class="close-reveal-modal">&#215;</a>
</div>
<?php endif;
}
add_action( 'wp_footer', 'required_page_content_reveal' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment