Pressbooks\Book::getFirst PHP Метод

getFirst() статический публичный Метод

Select the very first post in a book. May be a chapter or a front matter post
static public getFirst ( ) : string
Результат string permalink of the first post
    static function getFirst()
    {
        global $blog_id;
        $book_structure = static::getBookStructure();
        $order = $book_structure['__order'];
        $pos = array_keys($order);
        reset($pos);
        while ($first_id = current($pos)) {
            if ('publish' == $order[$first_id]['post_status']) {
                break;
            } elseif (current_user_can_for_blog($blog_id, 'read_private_posts')) {
                break;
            } elseif (get_option('permissive_private_content') && current_user_can_for_blog($blog_id, 'read')) {
                break;
            } else {
                next($pos);
            }
        }
        return empty($first_id) ? '/' : get_permalink($first_id);
    }