Display Child Pages title & content on Parent Page


Display all child and sub child pages using parent ID

This way the page that you are on will show in a post type the child pages of that page

 

<?php
$pages = get_pages('child_of=7&sort_column=post_date&sort_order=desc'); //Replace your parent id with 7
$count = 0;
foreach($pages as $page)
{
$content = $page->post_content;
?>
<h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2>
<p><?php echo $content ?></p>
<?php
}
?>



Advertisements

Insert Featured Image In Style Background


Insert Featured Image In Style Background :

<section class="banner inner-banner" style="background:url(<?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); if(!empty($feat_image)){echo $feat_image;}else { echo bloginfo('template_url')."/images/inner-baner.jpg";} ?>) no-repeat top center; height:395px;">