-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
52 lines (50 loc) · 1.68 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<title><?php
print_title();
?></title>
<meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<?php wp_head(); ?>
</head>
<body>
<header id="header">
<hgroup>
<h1 id="site-title"><?php print_title()?></h1>
</hgroup>
<?php if ( has_nav_menu('main-menu') ) {
echo '<nav id="navigation">';
wp_nav_menu(
array(
'container'=>null
,'depth'=>1
,'theme_location'=>'main-menu'
)
);
if (is_page()) {
if ($post->post_parent) {
$ancestors = get_post_ancestors($post->ID);
$root = count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent = $post->ID;
}
$children = wp_list_pages(
array(
'child_of'=>$parent
,'depth'=>2
,'echo'=>0
,'menu_class'=>'menu'
,'post_status'=>'publish'
,'title_li'=>null
,'sort_column'=>'menu_order'
)
);
if ($children) {
echo "<ul id=\"sub-menu\"class=\"menu\">$children</ul>";
}
}
echo '</nav>';
} ?>
</header>