LLMS_Section::get_previous()
Retrieve the previous section
Return Return
(LLMS_Section|false)
Source Source
File: includes/models/model.llms.section.php
public function get_previous() {
$siblings = $this->get_siblings( 'ids' );
$index = array_search( $this->get( 'id' ), $siblings );
/**
* The `$index` var will be `0` if we're on the first section and
* will be `false` if the current section isn't found.
*/
if ( $index ) {
return llms_get_post( $siblings[ $index - 1 ] );
}
return false;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.13.0 | Introduced. |