WordPress.org

Support

Support » How-To and Troubleshooting » is_page broken in wp 2.5.1 ?

is_page broken in wp 2.5.1 ?

  • <?
    
    function get_the_pa_ges() {
      global $wpdb;
      if ( ! $these_pages = wp_cache_get('these_pages', 'pages') ) {
         $these_pages = $wpdb->get_results('select ID, post_title from '. $wpdb->posts .' where post_status = "publish" and post_type = "page" order by ID');
    
       }
      return $these_pages;
    }
    
    function findPage() {
    	print "<!-- DEBUG ";
    	$all_pages = get_the_pa_ges ();
    	foreach ($all_pages as $thats_all){
    		$the_page_id = $thats_all->ID;
    
    		print $the_page_id;
    
    		if (is_page($the_page_id)) {
    			print " -> YEAH !";
    		}
    		print "\n";
    	}
    	print "-->";
    }
    
    findPage();
    
    ?>

    I put this in my header.php
    and it seems that it can never find the correct page (no YEAH text)

    any ideas what I am doing wrong ?
    Basically I am trying to highlight menu options depending on the page, and all my attempt using is_page failed so far

    thank you for your time !

Viewing 2 replies - 1 through 2 (of 2 total)
  • Some more infos,

    in my page section of my admin section, I can’t see any of my pages, though I can see published (15)

    this could explain why I can’t use is_page, they are nowhere to be found, though they are in the db …

    what’s going on ?

    well guys, I found where my problem was coming from …

    do not name your global variable $page_id ….

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘is_page broken in wp 2.5.1 ?’ is closed to new replies.