<?php /** * Doob functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package doob */ define('DOOB_THEME_URI', get_template_directory_uri()); define('DOOB_THEME_DIR', get_template_directory()); define('DOOB_CSS_URL', get_template_directory_uri() . '/assets/css/'); define('DOOB_RTL_CSS_URL', get_template_directory_uri() . '/assets/css/rtl/'); define('DOOB_JS_URL', get_template_directory_uri() . '/assets/js/'); define('DOOB_RTL_JS_URL', get_template_directory_uri() . '/assets/js/rtl/'); define('DOOB_ADMIN_CSS_URL', get_template_directory_uri() . '/assets/admin/css/'); define('DOOB_ADMIN_JS_URL', get_template_directory_uri() . '/assets/admin/js/'); define('DOOB_FREAMWORK_DIRECTORY', DOOB_THEME_DIR . '/inc/'); define('DOOB_FREAMWORK_HELPER', DOOB_THEME_DIR . '/inc/helper/'); define('DOOB_FREAMWORK_OPTIONS', DOOB_THEME_DIR . '/inc/options/'); define('DOOB_FREAMWORK_CUSTOMIZER', DOOB_THEME_DIR . '/inc/customizer/'); define('DOOB_THEME_PREFIX', 'doob'); define('DOOB_WIDGET_PREFIX', 'doob'); define('DOOB_FREAMWORK_LAB', DOOB_THEME_DIR . '/inc/lab/'); define('DOOB_FREAMWORK_TP', DOOB_THEME_DIR . '/template-parts/'); define('DOOB_IMG_URL', DOOB_THEME_URI . '/assets/images/logo/'); define('DOOB_WOOCMMERCE', DOOB_THEME_DIR . '/woocommerce/custom/'); $doob_theme_data = wp_get_theme(); define('DOOB_VERSION', (WP_DEBUG) ? time() : $doob_theme_data->get('Version')); if (!function_exists('doob_setup')) : /** * 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. */ function doob_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on doob, use a find and replace * to change 'doob' to the name of your theme in all the template files. */ load_theme_textdomain('doob', get_template_directory() . '/languages'); // Add default posts and comments RSS feed links to head. add_theme_support('automatic-feed-links'); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded <title> tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support('title-tag'); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support('post-thumbnails'); // This theme uses wp_nav_menu() in one location. register_nav_menus(array( 'primary' => esc_html__('Primary', 'doob'), 'footerbottom' => esc_html__('Footer Bottom Menu (No depth supported)', 'doob'), )); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support('html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', )); // Add theme support for selective refresh for widgets. add_theme_support('customize-selective-refresh-widgets'); /** * Post Format */ add_theme_support('post-formats', array('gallery', 'link', 'quote', 'video', 'audio')); add_theme_support('responsive-embeds'); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // Fonts Support for block editor add_editor_style( array( 'style-editor.css', doob_fonts_url() ) ); // Add support for Block Styles. add_theme_support( 'wp-block-styles' ); // Add support for full and wide align images. add_theme_support( 'align-wide' ); // Add support for editor styles. add_theme_support( 'editor-styles' ); // Enqueue editor styles. add_editor_style( 'style-editor.css' ); add_theme_support( 'editor-color-palette', array( array( 'name' => esc_html__( 'primary', 'doob' ), 'slug' => 'primary', 'color' => '#f9004d', ), array( 'name' => esc_html__( 'Secondary', 'doob' ), 'slug' => 'secondary', 'color' => '#00D09C', ), array( 'name' => esc_html__( 'Dark', 'doob' ), 'slug' => 'dark', 'color' => '#1f1f25', ), array( 'name' => esc_html__( 'Gray', 'doob' ), 'slug' => 'gray', 'color' => '#717173', ), array( 'name' => esc_html__( 'Light', 'doob' ), 'slug' => 'light', 'color' => '#f8f9fc', ), array( 'name' => esc_html__( 'White', 'doob' ), 'slug' => 'white', 'color' => '#ffffff', ), ) ); add_theme_support( 'editor-font-sizes', array( array( 'name' => esc_html__( 'Small', 'doob' ), 'size' => 12, 'slug' => 'small' ), array( 'name' => esc_html__( 'Normal', 'doob' ), 'size' => 16, 'slug' => 'normal' ), array( 'name' => esc_html__( 'Large', 'doob' ), 'size' => 36, 'slug' => 'large' ), array( 'name' => esc_html__( 'Huge', 'doob' ), 'size' => 50, 'slug' => 'huge' ) ) ); add_theme_support( 'custom-logo', array( 'height' => 100, 'width' => 400, 'flex-height' => true, 'flex-width' => true, ) ); register_block_pattern( 'doob/hero-section', array( 'title' => __( 'Hero Section', 'doob' ), 'description' => __( 'A hero section with a heading and button.', 'doob' ), 'content' => '<!-- wp:heading --><h2>Welcome to our site!</h2><!-- /wp:heading -->', ) ); /** * Add Custom Image Size */ add_image_size('doob-thumbnail-sm', 407, 304, true); add_image_size('doob-thumbnail-md', 627, 469, true); add_image_size('doob-thumbnail-lg', 830, 430, true); add_image_size('doob-thumbnail-portrait', 700, 1000, true); add_image_size('doob-thumbnail-single', 1270, 950, true); } endif; add_action('after_setup_theme', 'doob_setup'); add_filter('image_size_names_choose', 'doob_new_image_sizes'); if (!function_exists('doob_new_image_sizes')) { /** * Image Size Name Choose * * @param $sizes * @return array */ function doob_new_image_sizes($sizes) { return array_merge($sizes, array( 'doob-thumbnail-sm' => esc_html__('Thumbnail Small - (407x304)', 'doob'), 'doob-thumbnail-md' => esc_html__('Thumbnail Medium - (627x469)', 'doob'), 'doob-thumbnail-lg' => esc_html__('Thumbnail large - (791x420)', 'doob'), 'doob-thumbnail-portrait' => esc_html__('Thumbnail Portrait - (700X1000)', 'doob'), 'doob-thumbnail-single' => esc_html__('Thumbnail Single - (1270x950)', 'doob'), )); } } /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function doob_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters('doob_content_width', 640); } add_action('after_setup_theme', 'doob_content_width', 0); /** * Enqueue scripts and styles. */ require_once( DOOB_FREAMWORK_DIRECTORY . 'scripts.php'); /** * Global Functions */ require_once( DOOB_FREAMWORK_DIRECTORY . 'global-functions.php'); /** * Register Custom Widget Area */ require_once( DOOB_FREAMWORK_DIRECTORY . 'widget-area-register.php'); /** * Register Custom Fonts */ require_once( DOOB_FREAMWORK_DIRECTORY . 'register-custom-fonts.php'); /** * TGM */ require_once( DOOB_FREAMWORK_DIRECTORY . 'tgm-config.php'); /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/underscore/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/underscore/template-functions.php'; // get_template_part('inc/underscore/template-functions'); /** * Customizer additions. */ require get_template_directory() . '/inc/underscore/customizer.php'; /** * Load Jetpack compatibility file. */ if (defined('JETPACK__VERSION')) { require get_template_directory() . '/inc/underscore/jetpack.php'; } /** * Doob_Helper Template */ require_once( DOOB_FREAMWORK_HELPER . 'menu-area-trait.php'); require_once( DOOB_FREAMWORK_HELPER . 'layout-trait.php'); require_once( DOOB_FREAMWORK_HELPER . 'option-trait.php'); require_once( DOOB_FREAMWORK_HELPER . 'meta-trait.php'); require_once( DOOB_FREAMWORK_HELPER . 'title-trait.php'); require_once( DOOB_FREAMWORK_HELPER . 'social-trait.php'); // Doob_Helper require_once( DOOB_FREAMWORK_HELPER . 'helper.php'); /** * Options */ require_once( DOOB_FREAMWORK_OPTIONS . 'theme/option-framework.php'); require_once( DOOB_FREAMWORK_OPTIONS . 'menu-options.php'); require_once( DOOB_FREAMWORK_OPTIONS . 'page-options.php'); require_once( DOOB_FREAMWORK_OPTIONS . 'post-format-options.php'); require_once( DOOB_FREAMWORK_OPTIONS . 'user-extra-meta.php'); require_once( DOOB_FREAMWORK_OPTIONS . 'portfolio-meta.php'); /** * Lab */ require_once( DOOB_FREAMWORK_LAB . 'class-tgm-plugin-activation.php'); require_once DOOB_FREAMWORK_DIRECTORY . "demo-import-config.php"; // -- Nav Walker require_once( DOOB_FREAMWORK_LAB . 'nav-menu-walker.php'); require_once( DOOB_FREAMWORK_LAB . 'mobile-menu-walker.php'); require_once( DOOB_FREAMWORK_LAB . 'onepage-nav-menu-walker.php'); require_once( DOOB_FREAMWORK_TP . 'title/breadcrumb.php'); /** * Customizer */ require_once( DOOB_FREAMWORK_CUSTOMIZER . 'color.php'); // WooCommerce if (class_exists('WooCommerce')) { require_once(DOOB_WOOCMMERCE . "wooc-functions.php"); require_once(DOOB_WOOCMMERCE . "wooc-hooks.php"); } function doob_insert_all_essential_query($qvars) { $qvars[] = 'blog_layout'; $qvars[] = 'blog_sidebar'; $qvars[] = 'blog_column'; return $qvars; } add_filter('query_vars', 'doob_insert_all_essential_query');