Skip to content

Instantly share code, notes, and snippets.

@richstrauss
Last active December 17, 2017 15:19
Show Gist options
  • Save richstrauss/aaeb34b5c12665af0ec7a601a0a83f39 to your computer and use it in GitHub Desktop.
Save richstrauss/aaeb34b5c12665af0ec7a601a0a83f39 to your computer and use it in GitHub Desktop.
GeneratePress Custom Post Type Previous/Next Navigation & Entry Meta
<?php
// Single Custom Post Type >> https://generatepress.com/forums/topic/nextprevious-post-links-on-cpt/#post-326390
add_action( 'generate_after_entry_content', 'tu_custom_post_type_post_nav' );
function tu_custom_post_type_post_nav() {
if ( 'my-post-type' == get_post_type() ) : ?>
<footer class="entry-meta">
<?php generate_entry_meta(); ?>
<?php if ( is_single() ) generate_content_nav( 'nav-below' ); ?>
</footer><!-- .entry-meta -->
<?php endif;
}
// Custom Post Type Array >> https://generatepress.com/forums/topic/adding-previousnext-links-to-custom-post-types/#post-333104
add_action( 'generate_after_entry_content', 'tu_custom_post_type_post_nav' );
function tu_custom_post_type_post_nav() {
if ( in_array(get_post_type(), array('things','bars','clubs') ) ) : ?>
<footer class="entry-meta">
<?php generate_entry_meta(); ?>
<?php if ( is_single() ) generate_content_nav( 'nav-below' ); ?>
</footer><!-- .entry-meta -->
<?php endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment