"; echo "\n"; // Query WP database to find page parent $page = $wp_query->post; $parent_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE ID ='$page->post_parent;'"); if(!$parent_id) $parent_id = $post->ID; // $parent_id is resultant variable for parent post id // Establish navigation menu list of pages and URLs, repeat for each page // $ip_01 is value for the if(is_page('pagename')) function // $mn_01 is menu name for parent page appearing in navigation menu // $nl_01 is navigation link, or the link to the page in the menu // The section below is your script menu... $ip_01 = 'home'; $mn_01 = 'Home'; $nl_01 = '/'; $ip_02 = 'activities'; $mn_02 = 'Activities'; $nl_02 = '/activities/'; $ip_03 = 'blog'; $mn_03 = 'Blog'; $nl_03 = '/blog/'; $ip_04 = 'contact'; $mn_04 = 'Contact'; $nl_04 = '/contact/'; $ip_05 = 'corporate'; $mn_05 = 'Corporate'; $nl_05 = '/corporate/'; $ip_06 = 'links'; $mn_06 = 'Links'; $nl_06 = '/links/'; $ip_07 = 'press'; $mn_07 = 'Press'; $nl_07 = '/press/'; // Establish common navigation link elements for link writing // $cpo is current page opening html for current_page styling $cpo = '
  • '; // $cli is close list item html $cli = '
  • '; // Begin the IsPage section // Is this home page if(is_page('' .$ip_01 .'')) { echo "$cpo$nl_01$ct$mn_01$cli"; echo "\n"; } else { echo "$pi$nl_01$ct$mn_01$cli"; echo "\n"; } // Is this Activities related page // If is this page and it has children if(is_page('' .$ip_02 .'') && (wp_list_pages("child_of=".$post->ID."&echo=0"))) { echo "$cpo$nl_02$ct$mn_02$cli"; echo "\n\t\n"; // If is this page and it has no children } elseif (is_page('' .$ip_02 .'')) { echo "$cpo$nl_02$ct$mn_02$cli"; // If is child of this parent page } elseif ($post->post_parent && $parent_id == 2) { // id in WP, not your script menu! echo "$pi$nl_02$ct$mn_02$cli"; echo "\n\t\n"; // If is some other page } else { echo "$pi$nl_02$ct$mn_02$cli"; echo "\n"; } // Link for blog page, which has separate sidebar menu echo "$pi$nl_03$ct$mn_03$cli"; echo "\n"; // Is this Contact related page // If is this page and it has children if(is_page('' .$ip_04 .'') && (wp_list_pages("child_of=".$post->ID."&echo=0"))) { echo "$cpo$nl_04$ct$mn_04$cli"; echo "\n\t\n"; // If is this page and it has no children } elseif (is_page('' .$ip_04 .'')) { echo "$cpo$nl_04$ct$mn_04$cli"; // If is child of this parent page } elseif ($post->post_parent && $parent_id == 4) { // id in WP, not your script menu! echo "$pi$nl_04$ct$mn_04$cli"; echo "\n\t\n"; // If is some other page } else { echo "$pi$nl_04$ct$mn_04$cli"; echo "\n"; } // Is this Corporate related page // If is this page and it has children if(is_page('' .$ip_05 .'') && (wp_list_pages("child_of=".$post->ID."&echo=0"))) { echo "$cpo$nl_05$ct$mn_05$cli"; echo "\n\t\n"; // If is this page and it has no children } elseif (is_page('' .$ip_05 .'')) { echo "$cpo$nl_05$ct$mn_05$cli"; // If is child of this parent page } elseif ($post->post_parent && $parent_id == 5) { // id in WP, not your script menu! echo "$pi$nl_05$ct$mn_05$cli"; echo "\n\t\n"; // If is some other page } else { echo "$pi$nl_05$ct$mn_05$cli"; echo "\n"; } // Is this Links related page // If is this page and it has children if(is_page('' .$ip_06 .'') && (wp_list_pages("child_of=".$post->ID."&echo=0"))) { echo "$cpo$nl_06$ct$mn_06$cli"; echo "\n\t\n"; // If is this page and it has no children } elseif (is_page('' .$ip_06 .'')) { echo "$cpo$nl_06$ct$mn_06$cli"; // If is child of this parent page } elseif ($post->post_parent && $parent_id == 20) { // id in WP, not your script menu! echo "$pi$nl_06$ct$mn_06$cli"; echo "\n\t\n"; // If is some other page } else { echo "$pi$nl_06$ct$mn_06$cli"; echo "\n"; } // Is this Press related page // If is this page and it has children if(is_page('' .$ip_07 .'') && (wp_list_pages("child_of=".$post->ID."&echo=0"))) { echo "$cpo$nl_07$ct$mn_07$cli"; echo "\n\t\n"; // If is this page and it has no children } elseif (is_page('' .$ip_07 .'')) { echo "$cpo$nl_07$ct$mn_07$cli"; // If is child of this parent page } elseif ($post->post_parent && $parent_id == 7) { // id in WP, not your script menu! echo "$pi$nl_07$ct$mn_07$cli"; echo "\n\t\n"; // If is some other page } else { echo "$pi$nl_07$ct$mn_07$cli"; echo "\n"; } // end list and close echo ""; ?>