LLMS_Section::get_previous()

Retrieve the previous section


Return Return

(LLMS_Section|false)


Top ↑

Source Source

File: includes/models/model.llms.section.php

182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
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;
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.