-
-
Save anonymous/26c44f9e474350c12864834452faa710 to your computer and use it in GitHub Desktop.
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
/* | |
* 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