Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created December 17, 2013 12:28
Show Gist options
  • Save tommcfarlin/f2310bfad60b60ae00bf to your computer and use it in GitHub Desktop.
Save tommcfarlin/f2310bfad60b60ae00bf to your computer and use it in GitHub Desktop.
[WordPress] An example of an easy way to check if a post is paginated.
<?php if ( acme_is_paginated_post() ) { ?>
<div class="post-pagination">
<?php wp_link_pages(); ?>
</div><!-- .post-pagination -->
<?php } // end if ?>
<?php
/**
* Determines whether or not the current post is a paginated post.
*
* @return boolean True if the post is paginated; false, otherwise.
* @package includes
* @since 1.0.0
*/
function acme_is_paginated_post() {
global $multipage;
return 0 !== $multipage;
} // end acme_is_paginated_post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment