next_post()
Description
Outputs a link to the next post. Can also return an array with details about the next post so that you can display the post's title, for example.
Note that this function loops, which means that when the last post is reached, the link returned will point to the first post.
Example array:
Array
(
[id] => 2
[slug] => example-post
[date] => 1302384138
[title] => Example Post
[post] => This is a totally riveting post.
[image] => lolcats.gif
[status] => 1
[link] => http://secretarycms.com/beta/site/site.php?page=blog&id=example-post
)
Usage
<?php
echo next_post();
$next_post= next_post( $return_data );
?>
Parameters
$return_data
- true or false
- optional
- default: false
True will force the function to return an array containing details about the next post.
Examples
Creating a standard next post link
<a href="<?php echo next_post(); ?>">Next post</a>
Using post details array in a link
<?php $next_post= next_post( true ); ?>
<a href="<?php echo $next_post['link']; ?>"><?php echo $next_post['title']; ?></a>
-
FAQ
- What is the Page Type and how do I use it?
- How do I make blog pagination work?
- How can I make next/previous buttons to navigate my projects?
- How do I include Vimeo, YouTube, SoundCloud etc in my projects, pages, blog posts?
- How do I make excerpts for my blog posts? (Using the {more} tag)
- View all (2 more)
-
General Documentation
-
Themes
-
Code Documentation