Created
July 9, 2015 06:08
-
-
Save vodanh1213/e2530e0ef3873141a569 to your computer and use it in GitHub Desktop.
mary wiki
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The Template for displaying all single posts. | |
* | |
* @package ThinkUpThemes | |
*/ | |
get_header(); ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php get_template_part( 'content', 'single' ); ?> | |
<?php if ( current_user_can( 'manage_options' ) ): ?> | |
<?php | |
$terms = get_the_terms( get_the_ID(), 'incsub_wiki_category' ); | |
if ( count( $terms ) ) { | |
$term = $terms[0]; | |
if ( $term->parent == 0 ) { | |
//fallback to default | |
thinkup_input_nav( 'nav-below' ); | |
} else { | |
$children = get_term_children( $term->parent, 'incsub_wiki_category' ); | |
$next = 0; | |
$prev = 0; | |
foreach ( $children as $key => $value ) { | |
if ( $value == $term->term_id ) { | |
if ( isset( $children[ $key - 1 ] ) ) { | |
$prev = $children[ $key - 1 ]; | |
} | |
if ( isset( $children[ $key + 1 ] ) ) { | |
$next = $children[ $key + 1 ]; | |
} | |
break; | |
} | |
} | |
//output | |
?> | |
<nav role="navigation" id="nav-below"> | |
<?php if ( $prev != 0 ): ?> | |
<div class="nav-previous"><a | |
href="<?php echo esc_url( get_term_link( $prev, 'incsub_wiki_category' ) ) ?>" | |
rel="prev"><span class="meta-icon"><i | |
class="icon-angle-left icon-large"></i></span><span class="meta-nav"> | |
<?php echo get_term( $prev, 'incsub_wiki_category' )->name ?></span></a> | |
</div> | |
<?php endif; ?> | |
<?php if ( $next != 0 ): ?> | |
<div class="nav-next"><a | |
href="<?php echo esc_url( get_term_link( $next, 'incsub_wiki_category' ) ) ?>" | |
rel="next"><span | |
class="meta-nav"><?php echo get_term( $next, 'incsub_wiki_category' )->name ?></span><span | |
class="meta-icon"><i class="icon-angle-right icon-large"></i></span></a></div> | |
<?php endif; ?> | |
</nav> | |
<?php | |
} | |
} else { | |
//fallbacl to default | |
thinkup_input_nav( 'nav-below' ); | |
} | |
?> | |
<?php endif; ?> | |
<?php thinkup_input_nav( 'nav-below' ); ?> | |
<?php edit_post_link( __( 'Edit', 'lan-thinkupthemes' ), '<span class="edit-link">', '</span>' ); ?> | |
<?php thinkup_input_allowcomments(); ?> | |
<?php endwhile; ?> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment