Posts Tagged ‘open source’

Show Only Children Pages on Parent Page

August 3rd, 2009

There is still much to be desired within WordPress when it comes to dealing with parent and children pages. The core code is there, and it’s usable, but there’s not a lot “out of the box” to play with.

We’ve developed a bit of code to help make your life a little easier.

Adding the code below to your functions.php file will let you remove the other children pages while on the parent page.

add_filter('wp_list_pages_excludes', 'remove_others_children');
function remove_others_children($excludes = array()) {
  $all_pages = get_pages();
  $all_children = (array) get_page_children(true, $all_pages);
  foreach ( $all_children as $child )
    $excludes[] = $child->ID;

  if ( ! is_page() )
    return $excludes;

  global $post;

  $this_heirarchy = (array) $post->ancestors;
  $this_children = (array) get_page_children($post->ID, $all_pages);
  foreach ( $this_heirarchy as $ancestor )
    $this_children = array_merge($this_children, (array) get_page_children($ancestor, $all_pages));

  foreach ($this_children as $child)
    $this_heirarchy[] = $child->ID;

  return array_diff($excludes, $this_heirarchy);
}

Here are some examples of what it would like without the code, then with the code.

WordPress:  Remove Children Pages from Parent Pages

A huge thanks goes out to Matt Martz for working with us on helping get this code ready.

Fireside Media LLC Software Development

February 20th, 2008

We have the start of what will be a long line of open source products by Fireside Media, LLC. To start it, we are releasing an updated version of the Twitter Updater plugin.

The plugin was originally written by Victoria, but she gave us permission to release the updated version here. The plugin was modified by Jonathan to include tinyurl.com’s API as part of the Twitter updating.

We have some other great ideas for WordPress plugins already coming along and will be releasing them in stages. Expect some new plugins to come out within the next few weeks.