Add a ‘Read More’ link to the get_pages loop
-
the Codex offers this great bit of code to loop through the child pages of the parent and show the page title and page contents:
<?php $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc'); $count = 0; foreach($pages as $page) { $content = $page->post_content; if(!$content) continue; $content = apply_filters('the_content', $content); ?> <h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2> <div class="entry"><?php echo $content ?></div> <?php } ?>
I can’t figure out how to add a ‘Read More…’ link to the_content, as the code above is adding the_content to the apply_filters function, and echoing out $content. Any ideas?
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘Add a ‘Read More’ link to the get_pages loop’ is closed to new replies.