Title: Making it work with Sidebar.php
Last modified: September 3, 2016

---

# Making it work with Sidebar.php

 *  [cghore](https://wordpress.org/support/users/cghore/)
 * (@cghore)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/making-it-work-with-sidebarphp/)
 * The plugin works great for the default WP navigation menu features. On one of
   my sites, WP takes care of the menus, but the sidebar.php file is customized 
   and the plug-in needed to be manually integrated into it.
 * If you are using a custom sidebar.php file, you can use the following snippets
   to filter out the excluded IDs.
 * $excluded_ids_arr = ep_get_excluded_ids(); // get an array of IDs that are excluded
   using the Exclude Pages plug-in ep_get_excluded_ids() function.
 * $excluded_ids = implode(“,”,$excluded_ids_arr); // get a string of comma separate
   IDs
 * Anywhere you call wp_list_pages, you can exclude pages as follows:
    $myPosts 
   = wp_list_pages(array(‘exclude’=>$excluded_ids,’echo’=>0)); I have more members
   in the parameter array but am keeping it brief here for simplicity.
 * If you are using get_children(), you will need to loop through the list of child
   posts and skip any of the excluded IDs. Here is a snippet to better explain:
   
   $parent_child_posts = get_children(array(‘post_status’=>’publish’, ‘orderby’=
   >’menu_order’, ‘order’=>ASC, ‘post_parent’=>$post->post_parent));
 *     ```
       foreach ( $parent_child_posts as $parentChildPost )
       {
          // skip excluded IDs
          if ( in_array($parentChildPost->ID, $excluded_ids_arr) )
          {
             continue;
          }
          ... more code that does something with the included IDs ..
       }
       ```
   

The topic ‘Making it work with Sidebar.php’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/exclude-pages.svg)
 * [Exclude Pages](https://wordpress.org/plugins/exclude-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/exclude-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/exclude-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/exclude-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/exclude-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/exclude-pages/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [cghore](https://wordpress.org/support/users/cghore/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/making-it-work-with-sidebarphp/)