• fredricz

    (@fredricz)


    Hey,
    Im trying to create a front page with child pages on it. So I can create child pages and it automatically adds to my front page. The problem is that I also want to create child-child pages and only show them when I enter a child page. Is it possible?

    Code today:

    <?php
    	$pages = get_pages('child_of='.$post->ID.'&sort_column=post_date');
    	$count = 0;
    	foreach($pages as $page)
    	{
    $content = $page->post_content;
    		if(!$content)
    			continue;
    		if($count >= 5)
    			break;
    		$count++;
    		$content = apply_filters('the_content', $content);
    		$pageID = $page->ID
    		
    	?>
    		<section><div id=section><h2><a>ID) ?>"><?php echo $page->post_title ?></a></h2>
    		<?php echo $content ?></div><div id=big-picture style="background: url(<?php echo get_the_post_thumbnail_url($page->ID) ?>) no-repeat center center fixed;"></div></section>
    		<?php 
    	}
    ?>

    To be able to show only “child-pages” and when I enter a Child-page, show their child-pages.
    Thanks!

    • This topic was modified 6 years ago by fredricz.
    • This topic was modified 6 years ago by fredricz.
    • This topic was modified 6 years ago by Jan Dembowski.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • hyperionstudios

    (@hyperionstudios)

    get_pages should be working, and in the function you are asking for child pages of the current page, can you explain more what is not working for you?

Viewing 1 replies (of 1 total)
  • The topic ‘Help with child pages on frontpage’ is closed to new replies.