Skip to content

Instantly share code, notes, and snippets.

@thanh4890
Created March 1, 2014 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thanh4890/9284704 to your computer and use it in GitHub Desktop.
Save thanh4890/9284704 to your computer and use it in GitHub Desktop.
<?php
$previous_title = __( 'Previous Article', kopa_get_domain() );
$next_title = __( 'Next Article', kopa_get_domain() );
if ( 'staffs' === get_post_type() ) {
$previous_title = __( 'Previous Staff', kopa_get_domain() );
$next_title = __( 'Next Staff', kopa_get_domain() );
} elseif ( 'clients' === get_post_type() ) {
$previous_title = __( 'Previous Client', kopa_get_domain() );
$next_title = __( 'Next Client', kopa_get_domain() );
} elseif ( 'testimonials' === get_post_type() ) {
$previous_title = __( 'Previous Testimonial', kopa_get_domain() );
$next_title = __( 'Next Testimonial', kopa_get_domain() );
} elseif ( 'portfolio' === get_post_type() ) {
$previous_title = __( 'Previous Portfolio', kopa_get_domain() );
$next_title = __( 'Next Portfolio', kopa_get_domain() );
} elseif ( 'services' === get_post_type() ) {
$previous_title = __( 'Previous Service', kopa_get_domain() );
$next_title = __( 'Next Service', kopa_get_domain() );
}
$prev_post = get_previous_post();
if ( ! empty( $prev_post ) ) :
?>
<p class="prev-post">
<a href="<?php echo get_permalink( $prev_post->ID ); ?>">&laquo;&nbsp;<?php echo $previous_title; ?></a>
<a class="article-title" href="<?php echo get_permalink( $prev_post->ID ); ?>"><?php echo $prev_post->post_title; ?></a>
<span class="entry-date"><?php echo get_post_time( get_option( 'date_format' ), false, $prev_post->ID ); ?></span>
</p>
<?php endif; ?>
<?php
$next_post = get_next_post();
if ( ! empty( $next_post ) ) :
?>
<p class="next-post">
<a href="<?php echo get_permalink( $next_post->ID ); ?>"><?php echo $next_title; ?>&nbsp;&raquo;</a>
<a class="article-title" href="<?php echo get_permalink( $next_post->ID ); ?>"><?php echo $next_post->post_title; ?></a>
<span class="entry-date"><?php echo get_post_time( get_option( 'date_format' ), false, $next_post->ID ); ?></span>
</p>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment