Posted By

depiction on 01/13/11


Tagged

page wordpress id


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

qubestream


Get WordPress page ID outside of loop


 / Published in: PHP
 

  1. <?php
  2. function function_name() {
  3. global $wp_query;
  4. $thePostID = $wp_query->post->ID;
  5. }
  6. $pageid = $post->ID;
  7. if ($pageid == 69) { ?>
  8. <div id="header" id="69"></div>
  9. <?php } elseif ($pageid == 31) { ?>
  10. <div id="header" id="31"></div>
  11. <?php } else { ?>
  12. <div id="header"></div>
  13. <?php } ?>

Report this snippet  

You need to login to post a comment.