Support » Plugins » get_page and get_pages conflicts

  • sdaponte


    I have a template I’m using to pull up the first child page’s content, and a side navigation of the page’s children. The pseudo code of the structure is as follows:

    <div> include (children-nav.php) </div>
    <div> include (pull-child-page.php) </div>

    the children-nav page is working fine, and also has an include to a feature-page.php, which is pulling up the content of a “feature page” used in multiple places throughout the site.

    code for feature-page:

        $post = get_page($id);
        $content_page = apply_filters('the_content', $post->post_content);
        echo $content_page;


    $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=asc');
            $count = 0;
            foreach($pages as $page)
                    echo 'debug 1';
                    $content = $page->post_content;
                     echo 'debug 2';
                    if($count >= 1)
                    echo 'debug 3';
                    echo 'debug 4';
                    $content = apply_filters('the_content', $content);
                     echo 'debug 5';
                    <div class="entry"><?php echo $page->post_content; ?></div>

    The problem: both of these work on their own, but when used in the same page template they’re having conflict issues. I’m guessing it has something to do with the get_page and get_pages functions. Any other guesses?

Viewing 1 replies (of 1 total)
  • sdaponte


    So as per usual, by solving one problem, I’ve created another.

    at the end of my feature-page I’ve set $post and $page to empty strings, and am able to display the first child of my about section

    – About us (which is displaying in about)
    – management team

    This is the other section where this will be applicable:

    – Office locations (which I want to display)
    – Contact form

    However, the contact page is displaying the About Us page as well, which makes no sense to me since I’m not using a page id to grab that page.
    The code for the pull-child-page has remained exactly the same, except I’ve removed some extra parameters in the first line:
    $pages = get_pages('child_of='.$page->ID);
    So it now looks like this.

    This is driving me crazy! Any help is greatly appreciated!!

Viewing 1 replies (of 1 total)
  • The topic ‘get_page and get_pages conflicts’ is closed to new replies.