Skip to content

Instantly share code, notes, and snippets.

@whyisjake
Created September 10, 2012 18:07
Show Gist options
  • Save whyisjake/3692615 to your computer and use it in GitHub Desktop.
Save whyisjake/3692615 to your computer and use it in GitHub Desktop.
wp_link_pages
<?php $args = array(
'before' => '<div id="nav-buttons">',
'after' => '</div>',
'link_before' => '',
'link_after' => '',
'next_or_number' => 'next',
'nextpagelink' => __('<span class="carousel-control new next" style="font-size:60px;">&rsaquo;</span>'),
'previouspagelink' => __('<span class="carousel-control new prev" style="font-size:60px;">&lsaquo;</span>'),
'pagelink' => '%',
'echo' => 1
);
?>
<?php wp_link_pages($args); ?>
<script type="text/javascript">
var entryPermalink = '<?php the_permalink(); ?>';
jQuery(document).ready(function(){
// close window and return to article when clicking close button
jQuery('#return-link').click(function() {
window.opener.document.location.href = entryPermalink;
window.close();
return false;
});
jQuery('a span.badge').addClass('badge-info');
jQuery('#nav-buttons a:first-child ').addClass('prev');
jQuery('#nav-buttons a:last-child').addClass('next');
jQuery(document).bind('keydown', 'left', function() {
var url = jQuery('.prev').attr('href');
console.log(url);
if (url) {
window.location = url;
}
});
jQuery(document).bind('keydown', 'right', function() {
var url = jQuery('.next').attr('href');
console.log(url);
if (url) {
window.location = url;
}
});
});
</script>
<?php function make_slideshow_hotkeys() {
wp_enqueue_script(
'hotkeys',
get_template_directory_uri() . '/js/jquery.hotkeys.js',
array('jquery')
);
}
add_action('wp_enqueue_scripts', 'make_slideshow_hotkeys'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment