How do I isolate the homepage?
-
I am trying to isolate the homepage so that it shows a specific side navigation menu. The problem that I am running into is that for some reason the post ID and the category ID are the same for my “homepage” as they are for the “job bank” section of the site.
In my code I use the category ID to show another menu when in the job bank section, that is specific to this section.
How can I distinguish between these two “pages”?
Not sure if my description of the problem will make any sense or not.
The code I am using for the side menus is:
//If there is NOT a parent post, then page is top level page. Get list of children for this page. if(!$post->post_parent && $catID!=7 && $catID!=10) { if ($post->ID) { //menu list is children of current post ID $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1"); } else { $children = FALSE; } //If there IS a parent post and the post ID is one of the following //Display 2nd level of menu items (Quick Search, Employment, Education, Language Training) } elseif ($post->ID==45 || $post->ID==316 || $post->ID==321 || $post->ID==1089) { //Display the post ID and it's children $children = wp_list_pages ("&title_li=&child_of=".$post->ID."&echo=0&depth=1"); //Takes into account that job bank children cannot be children of job bank CATEGORY. //Creates side menu for job bank pages } elseif ($catID==7 || $catID==10) { $children = wp_list_pages ("&title_li=&child_of=783&echo=0&depth=1"); //In all other cases there should be a parent post. //Displays 1st level menu for all child pages (except those specified above). } else { //Display a menu listing that is children of the parent $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=1"); } //Display children pages, if any, in side menu if ($children) { echo $children; } else { //If there aren't any children pages (ie. homepage), display the following default pages wp_list_pages ("include=675, 72, 129, 175&title_li="); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘How do I isolate the homepage?’ is closed to new replies.