600, 'width' => 1360, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description-text', ) ) ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-list', 'gallery', 'caption', ) ); /* * Remove themes' post formats support */ remove_theme_support( 'post-formats' ); /* * Add the editor style and fonts */ add_editor_style( array( felt_google_fonts_url(), 'editor-style.css', ) ); /* * Enable support for Visible Edit Shortcuts in the Customizer Preview * * @link https://make.wordpress.org/core/2016/11/10/visible-edit-shortcuts-in-the-customizer-preview/ */ add_theme_support( 'customize-selective-refresh-widgets' ); } } add_action( 'after_setup_theme', 'felt_setup' ); /** * 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 felt_content_width() { $GLOBALS['content_width'] = apply_filters( 'felt_content_width', 720 ); } add_action( 'after_setup_theme', 'felt_content_width', 0 ); function felt_custom_tiled_gallery_width() { $width = pixelgrade_option( 'main_content_container_width', 1300 ); if ( pixelgrade_is_active_sidebar( 'sidebar-1' ) ) { $width = pixelgrade_option( 'main_content_container_width', 1300 ) - 300 - 56; } return $width; } add_filter( 'tiled_gallery_content_width', 'felt_custom_tiled_gallery_width' ); /** * Enqueue scripts and styles. */ function felt_scripts() { $theme = wp_get_theme( get_template() ); $main_style_deps = array(); $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; /* Default Google Fonts */ wp_enqueue_style( 'felt-google-fonts', felt_google_fonts_url() ); /* Default Self-hosted Fonts should be loaded when Customify is off */ if ( ! class_exists( 'PixCustomifyPlugin' ) || ! pixelgrade_user_has_access( 'pro-features' ) ) { wp_register_style( 'felt-fonts-hkgrotesk', felt_hkgrotesk_font_url() ); $main_style_deps[] = 'felt-fonts-hkgrotesk'; } /* The main theme stylesheet */ wp_enqueue_style( 'felt-style', get_template_directory_uri() . '/style.css', $main_style_deps, $theme->get( 'Version' ) ); wp_style_add_data( 'felt-style', 'rtl', 'replace' ); /* Scripts */ wp_register_script( 'tweenmax', get_theme_file_uri( '/assets/js/TweenMax.min.js' ), array(), '2.0.2', true ); wp_register_script( 'select2',get_theme_file_uri( '/assets/js/select2' . $suffix . '.js' ), array(), '4.0.5', true ); wp_register_script( 'slick',get_theme_file_uri( '/assets/js/slick' . $suffix . '.js' ), array(), '1.9.0', true ); wp_enqueue_script( 'felt-scripts', get_theme_file_uri( '/assets/js/scripts' . $suffix . '.js' ), array( 'jquery', 'masonry', 'imagesloaded', 'hoverIntent', 'tweenmax', 'select2', 'slick' ), $theme->get( 'Version' ), true ); wp_localize_script( 'felt-scripts', 'feltStrings', array( 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ), ) ); } add_action( 'wp_enqueue_scripts', 'felt_scripts' ); function felt_gutenberg_styles() { wp_enqueue_style( 'felt-gutenberg', get_theme_file_uri( '/editor.css' ), false ); wp_enqueue_style( 'felt-font-hkgrotesk', felt_hkgrotesk_font_url() ); $content_width = pixelgrade_option( 'main_content_content_width' ); $container_width = pixelgrade_option( 'main_content_container_width', 1300 ) - 300; $style = ' .edit-post-visual-editor[class] .editor-block-list__block, .edit-post-visual-editor[class] .editor-post-title__block { max-width: ' . $content_width . 'px; } .editor-block-list__layout .editor-block-list__block[data-type="core/gallery"], .editor-block-list__layout .editor-block-list__block[data-align=left], .editor-block-list__layout .editor-block-list__block[data-align=right] { max-width: ' . $container_width . 'px; }'; wp_add_inline_style( 'felt-gutenberg', $style ); } add_action( 'enqueue_block_editor_assets', 'felt_gutenberg_styles' ); function felt_load_wp_admin_style() { wp_register_style( 'felt_wp_admin_css', get_template_directory_uri() . '/admin.css', false, '1.0.0' ); wp_enqueue_style( 'felt_wp_admin_css' ); } add_action( 'admin_enqueue_scripts', 'felt_load_wp_admin_style' ); /* * ================================================== * Load all the files directly in the `inc` directory * ================================================== */ pixelgrade_autoload_dir( 'inc' );