Guest User

Excluding WordPress Pages

a guest
Jul 4th, 2010
262
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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');
RAW Paste Data