prev_post()
Description
Outputs a link to the previous post. Can also return an array with details about the previous post so that you can display the post's title, for example.
Note that this function loops, which means that when the first post is reached, the link returned will point to the last 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 prev_post();
$prev_post= prev_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 previous post.
Examples
Creating a standard next post link
<a href="<?php echo prev_post(); ?>">Previous post</a>
Using post details array in a link
<?php $prev_post= prev_post( true ); ?>
<a href="<?php echo $prev_post['link']; ?>"><?php echo $prev_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