get_page and get_pages conflicts
-
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:
$id=65; $post = get_page($id); $content_page = apply_filters('the_content', $post->post_content); echo $content_page;
pull-child-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(!$content) continue; if($count >= 1) break; echo 'debug 3'; $count++; echo 'debug 4'; $content = apply_filters('the_content', $content); echo 'debug 5'; ?> <div class="entry"><?php echo $page->post_content; ?></div> <?php }
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)
Viewing 1 replies (of 1 total)
- The topic ‘get_page and get_pages conflicts’ is closed to new replies.