WordPress conditional Statement for Parent Pages

asked Jan 5, 2013 in Website Builder by Maria (1,020 points)
I am currently working on a WP template page for a few different pages, some of these pages are parent pages and some are  childe pages. My parents pages don’t have a title, but the child pages. I want to write a conditional statement that would call the <h1>><?php my_title(); ?></h1> of the child pages. How can I do this?
Please help

1 Answer

0 like 0 dislike
answered Jan 5, 2013 by WebGuru (9,280 points)

<?php if( $post->post_parent ) { ?>
<h1><?php My_title(); ?></h1>
<?php } ?>