sarkfultion
⌂
›
wp-content
›
themes
›
sinatra
›
inc
›
core
sarkfultion
5 dreads
↑ redisq
📄
class-sinatra-db-updater.php
3,115 B
sarkfultion
dreads
📄
class-sinatra-enqueue-scripts.php
4,736 B
sarkfultion
dreads
📄
class-sinatra-fonts.php
11,714 B
sarkfultion
dreads
📄
class-sinatra-options.php
26,334 B
sarkfultion
dreads
📄
class-sinatra-theme-setup.php
6,446 B
sarkfultion
dreads
redisq: class-sinatra-theme-setup.php
<?php /** * Sinatra Theme Setup Class. * * @package Sinatra * @author Sinatra Team <hello@sinatrawp.com> * @since 1.0.0 */ /** * Do not allow direct script access. */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( 'Sinatra_Theme_Setup' ) ) : /** * Sinatra Options Class. */ class Sinatra_Theme_Setup { /** * Singleton instance of the class. * * @since 1.0.0 * @var object */ private static $instance; /** * Main Sinatra_Theme_Setup Instance. * * @since 1.0.0 * @return Sinatra_Theme_Setup */ public static function instance() { if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Sinatra_Theme_Setup ) ) { self::$instance = new Sinatra_Theme_Setup(); } return self::$instance; } /** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Add theme supports. add_action( 'after_setup_theme', array( $this, 'setup' ), 10 ); // Register block patterns and block styles. add_action( 'init', array( $this, 'register_block_patterns' ) ); add_action( 'init', array( $this, 'register_block_styles' ) ); // Content width. add_action( 'wp', array( $this, 'content_width' ) ); } /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. * * @since 1.0.0 */ public function setup() { // Make the theme available for translation. load_theme_textdomain( 'sinatra', SINATRA_THEME_PATH . '/languages' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); // Add theme support for Post Thumbnails and image sizes. add_theme_support( 'post-thumbnails' ); // Add theme support for various Post Formats. add_theme_support( 'post-formats', array( 'gallery', 'image', 'link', 'quote', 'video', 'audio', 'status', 'aside', ) ); // Add title output. add_theme_support( 'title-tag' ); // Add wide image support. add_theme_support( 'align-wide' ); // Responsive embeds support. add_theme_support( 'responsive-embeds' ); // Add support for core block visual styles. add_theme_support( 'wp-block-styles' ); // Selective Refresh for Customizer. add_theme_support( 'customize-selective-refresh-widgets' ); // Excerpt support for pages. add_post_type_support( 'page', 'excerpt' ); // Register Navigation menu. register_nav_menus( array( 'sinatra-primary' => esc_html__( 'Primary Navigation', 'sinatra' ), ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', apply_filters( 'sinatra_custom_logo_args', array( 'width' => 200, 'height' => 40, 'flex-height' => true, 'flex-width' => true, ) ) ); // Add theme support for Custom Background. add_theme_support( 'custom-background', apply_filters( 'sinatra_custom_background_args', array( 'default-color' => '#FFFFFF', 'default-size' => 'fit', ) ) ); // Add theme support for Custom Header. add_theme_support( 'custom-header', apply_filters( 'sinatra_custom_header_args', array( 'default-image' => '', 'width' => 1920, 'height' => 500, 'flex-width' => true, 'flex-height' => true, 'uploads' => true, 'header-text' => false, ) ) ); // Enable HTML5 markup. $sinatra_html5 = array( 'search-form', 'gallery', 'caption', ); // 'script' and 'style' are deprecated and unused since WordPress 7.0. if ( version_compare( get_bloginfo( 'version' ), '7.0', '<' ) ) { $sinatra_html5[] = 'script'; $sinatra_html5[] = 'style'; } add_theme_support( 'html5', $sinatra_html5 ); // Add editor style. $sinatra_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; add_editor_style( 'assets/css/editor-style' . $sinatra_suffix . '.css' ); do_action( 'sinatra_after_setup_theme' ); } /** * Set the content width in pixels, based on the theme's design and stylesheet. * * @global int $content_width * @since 1.0.0 */ public function content_width() { global $content_width; if ( ! isset( $content_width ) ) { $content_width = apply_filters( 'sinatra_content_width', intval( sinatra_option( 'container_width' ) ) - 100 ); // phpcs:ignore } } /** * Register a block pattern. * * Block patterns are recommended by WordPress.org for classic themes as a * step toward block editor support. Keeps a single, simple pattern: a * three-column gallery grid the user can drop images into. * * @since 1.4.2 */ public function register_block_patterns() { if ( ! function_exists( 'register_block_pattern' ) ) { return; } $image = '<!-- wp:image {"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img alt=""/></figure><!-- /wp:image -->'; register_block_pattern( 'sinatra/gallery-grid', array( 'title' => esc_html__( 'Gallery Grid', 'sinatra' ), 'categories' => array( 'gallery' ), 'content' => '<!-- wp:gallery {"columns":3,"imageCrop":true,"linkTo":"none"} --><figure class="wp-block-gallery has-nested-images columns-3 is-cropped">' . str_repeat( $image, 6 ) . '</figure><!-- /wp:gallery -->', ) ); } /** * Register a block style. * * @since 1.4.2 */ public function register_block_styles() { if ( ! function_exists( 'register_block_style' ) ) { return; } register_block_style( 'core/group', array( 'name' => 'sinatra-card', 'label' => esc_html__( 'Card', 'sinatra' ), 'inline_style' => '.wp-block-group.is-style-sinatra-card{padding:2em;border:1px solid rgba(0,0,0,0.08);border-radius:6px;box-shadow:0 10px 30px rgba(0,0,0,0.06);}', ) ); } } endif; /** * The function which returns the one Sinatra_Options instance. * * @since 1.0.0 * @return object */ function sinatra_theme_setup() { return Sinatra_Theme_Setup::instance(); } sinatra_theme_setup();
sarkfultion