• 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.