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

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

Check if the current blog_id is considered a "book"
static public isBook ( ) : boolean
Результат boolean
    static function isBook()
    {
        // Currently, the main site is considered a "blog/landing page" whereas everything else is considered a "book".
        // We might improve this in the future.
        $is_book = is_main_site() === false;
        return $is_book;
    }

Usage Example

Пример #1
0
 /**
  * Register theme directories, set a filter that hides themes under certain conditions
  */
 function registerThemeDirectories()
 {
     // No trailing slash, otherwise we get a double slash bug
     // @see \PressBooks\Metadata::fixDoubleSlashBug
     register_theme_directory(PB_PLUGIN_DIR . 'themes-root');
     register_theme_directory(PB_PLUGIN_DIR . 'themes-book');
     if (is_admin()) {
         if (Book::isBook()) {
             add_filter('allowed_themes', array($this, 'allowedBookThemes'));
         } else {
             add_filter('allowed_themes', array($this, 'allowedRootThemes'));
         }
     }
 }
All Usage Examples Of Pressbooks\Book::isBook