How To Hide Certain Groups From A Wordpress Navigation Bar

The way to Hide Particular Categories From A Wordpress Navigation Bar A vital issue in any excellent WordPress theme is navigation. You are able to constantly add Page and Category widgets for your sidebar, but having a well planned navigation bar (or two) could make a massive difference for your blogs guests. Sadly, not all themes are created having a navbar, as well as those that do won't usually fit your individual requirements. You'd probably be astounded by how much you are able to really do with a WordPress navigation bar. First off, ask yourself how you plan to work with your navbar. The majority of the time, navigation bars list either categories or pages. Some web pages will display each, and can even combine the two into one particular line.. The only downside for the combined bar approach is that you can sometimes run out of space. **Changing Your Navbar From Pages To Categories (or vice versa)** There is an easy way which you can change what your navbar lists if it does not presently do what you need it to. To perform this, we'll be editing your theme's header.php file.. Your navigation bar is controlled by a template tag, either wp_list_pages or wp_list_categories. In your header.php file, you will locate among those tags. For those who must, you may just replace it using the a single you'd like to use as an alternative. More probably than not, there will currently be some paramaters within the tag's parenthesis - we'll be adding to these later on. **How To discover the ID of a Page or Category** Now that youve located the template tag thats controlling your navigation, its time for you to add a parameter to hide the pages you dont desire to see. Before we are able to do that, we'll have to grab the precise page(s) ID's As opposed to utilizing the name you provide (which could be utilized far more than as soon as), WordPress keeps track of pages and categories by assigning every single one a exclusive ID quantity. Obtaining that ID is simple. Just pull up the Page/Category list in WordPress and hover more than the item you happen to be functioning on - you'll see some hyperlinks for that item appear. The URL of that "edit" link consists of your page/category ID, so just spot your mouse more than it and examine the bottom of the browser. Safari customers will have to actually click on that "edit" link, because the destination URL is not displayed in that browser. The "Edit" URL will finish in either "post=" or "cat_id=" plus a quantity. That is your page/category ID. **How To Eliminate Person Pages or Categories** Essentially the most common factor that individuals choose to do is hide a page on their navigation bar. This might be a Thank You page for new subscribers, or an intermediate page for guests going by way of a specific approach. Hiding a page from your navigation bar is simply achieved by a parameter for your navigation tag. As you can in all probability guess, we're going to use what exactly is named the "exclude" parameter. To exclude the page you'd like, enter the parameter, followed by the ID in the page/category in query: wp_list_pages('exclude=4,37,22')  In this instance, Ive utilised list_pages, however it performs the same way with the categories tag. As you may see Ive included various IDs, separated by commas. You'll be able to just as very easily use only a single ID with no comma should you only have 1 item to hide. When entering your parameters, dont neglect to wrap them in parenthesis, and wrap them in quotation marks as Ive accomplished above. **Limiting Navigation To Particular Pages** In some cases it tends to make much more sense to pick unique pages to show. The exclude parameter will operate right here, but in the event you have a massive website, gathering ID's of all of the other pages could take a when. Moreover, every time you produce a brand new page or category, youll need to go back into header.php to add the new ID. Personally, I can think about greater ways to invest an afternoon. Never be concerned although! There's constantly the "include" parameter: wp_list_pages('include=4,37,22')  Just just like the "exclude" we applied earlier, "include" could be applied to each the web page and  wordpress customization service category based navigation tags. Note: The order which you list the IDs in doesn't effect the order the pages will show in. Rearranging the order from the pages can only be done on the "Edit Page" screen, in the "Attributes" section **Dealing With Various Parameters**  More typically than not, there are going to be other parameters in your tag - in addition for the one particular you happen to be adding today. This generally contains "title_li=" - which controls the title in the starting in the list of pages/categories. Normally, a navbar doesnt need a title, in this case, the parameter is left blank, with nothing after the equals sign. This is the equivalent of saying dont display any title. Heres an instance of that parameter in action: wp_list_pages('title_li=')  Okay, how do we get the current parameter(s) to function with all the new a single? Like this! wp_list_pages('title_li=&include=4,37,22') Couldn't be any easier! :) Just location an ampersand (&) at the finish of your current parameter(s), then add your new one. The only issue you need to be careful of is making sure the entire string of parameters is wrapped inside the quotes and parenthesis (just like before!). As long as those are in location (as shown above), you'll be all set! And that's the finish! That is all you may need to completely customize the show of one's navbar.  Enjoy!