I have run into an interesting issue.
My intention is to have a front-page.php that displays a list of pages, with titles and content (some of which may be truncated with tag.
I have augmented the below filtered arguments to do this, but have been unable to prevent it from displaying the full content each time:
Here's the code:
<?php
$args = array(
'sort_order' => 'asc',
'sort_column' => 'post_title',
'hierarchical' => 1,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
foreach( $pages as $page ) {
$content = $page->post_content;
if ( ! $content ) // Check for empty page
continue;
$content = apply_filters( 'the_content', $content );
?>
<h2><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h2>
<section class="<?php echo $page->post_name; ?>">
<div class="entry"><?php echo $content; ?></div>
</section>
<?php
}
?>
Now, I'm aware that:
<?php global $more; $more = 0; ?>
is the purported solution to this, but it does not appear to work, regardless of placement within the code.
Has anyone experienced similar and solved this? I further realise that using a WP Query with post type 'page' is a potential workaround, but have found that solution is not without it's own issues, like the ability to filter out sub pages.
Any advice will be greatly appreciated. I was unable to find a solution to this with a decent amount of interweb hunting.