Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created February 19, 2017 13:06
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 anonymous/26c44f9e474350c12864834452faa710 to your computer and use it in GitHub Desktop.
Save anonymous/26c44f9e474350c12864834452faa710 to your computer and use it in GitHub Desktop.
/*
* Get user's role
*/
if ( ! function_exists( 'sb_get_user_role' ) ) :
function sb_get_user_role( $user = null ) {
$user = $user ? new WP_User( $user ) : wp_get_current_user();
return $user->roles ? $user->roles[0] : false;
}
endif;
/**
* Child Pages Listing for Intranet
*/
if ( ! function_exists( 'sb_intranet_subpage_navigation' ) ) :
function sb_intranet_subpage_navigation() {
global $post;
if ( $post->post_parent ) :
$children = wp_list_pages( array(
'title_li' => '',
'child_of' => $post->post_parent,
'echo' => 0,
'depth' => 1
) );
$title = get_the_title( $post->post_parent );
else :
$children = wp_list_pages( array(
'title_li' => '',
'child_of' => $post->ID,
'echo' => 0,
'depth' => 1
) );
$title = get_the_title( $post->ID );
endif;
if ( $children ) : ?>
<aside id="secondary" class="widget-area" role="complementary">
<section class="widget widget_categories">
<h3 class="widget-title"><?php echo esc_attr( $title ); ?></h3>
<ul>
<?php
echo $children;
?>
</ul>
</section>
<aside>
<?php endif;
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment