Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Excluding WordPress Pages

By: a guest on Jul 4th, 2010  |  syntax: PHP  |  size: 0.55 KB  |  views: 161  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function exclude_navigation_pages($exclude_array) {
  2.         global $wpdb;
  3.         $post = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type='page'", "Museum"));
  4.         if($post) {
  5.                 $nav_ids = array($post);
  6.         }
  7.         elseif($_SERVER["SERVER_NAME"] == "localhost.tld") {
  8.                 $nav_ids = array(140);
  9.         }
  10.         elseif($_SERVER["SERVER_NAME"] == "livesite.com") {
  11.                 $nav_ids = array(127);
  12.         }
  13.         $exclude_merge = array_merge($nav_ids, $exclude_array);
  14.  
  15.         return $exclude_merge;
  16. }
  17. add_filter('wp_list_pages_excludes', 'exclude_navigation_pages');
clone this paste RAW Paste Data