By browsing this site you agree to our use of cookies. Ok. Close

WordPress tips: If a page is a parent of certain page

Web development tip: If you’d like do include something specific on a page that is a parent of a certain page in WordPress, use this code in your template file:

if ( $post->post_parent == '2' ) {
  // stuff

where ‘2’ is ID of the parent page

Comments are closed.