
Description:
get_boundary_post is very useful if you want to include show first or last post button below your single post or in you main index page.
Parameters:
$in_same_cat(optional)(boolean) – true if you want to show the first/last post for the current category $excluded_categories(optional)(string) – String of comma-separated category ids $start(optional)(boolean) – true to show first
Basic usage examples:
<?php $firstPost = get_boundary_post(true, "", true)); $lastPost = get_boundary_post(true); ?> <?php if($firstPost) : ?> <a href="<?php echo get_permalink($firstPost->ID)?>">« First post</a> <?php endif; ?> <?php if($lastPost) : ?> <a href="<?php echo get_permalink($lastPost->ID)?>">Next: <?php echo $lastPost->post_title; ?> »</a> <?php endif; ?>
Leave a Reply