From 7086111ad4dd997e12a3220e1ee60c9b9bcf0bb8 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 7 Jan 2020 13:06:14 +0100 Subject: Added wordpress --- .../wp-content/themes/twentynineteen/functions.php | 325 +++++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 srcs/wordpress/wp-content/themes/twentynineteen/functions.php (limited to 'srcs/wordpress/wp-content/themes/twentynineteen/functions.php') diff --git a/srcs/wordpress/wp-content/themes/twentynineteen/functions.php b/srcs/wordpress/wp-content/themes/twentynineteen/functions.php new file mode 100644 index 0000000..9d9c2c3 --- /dev/null +++ b/srcs/wordpress/wp-content/themes/twentynineteen/functions.php @@ -0,0 +1,325 @@ + 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' ); + set_post_thumbnail_size( 1568, 9999 ); + + // This theme uses wp_nav_menu() in two locations. + register_nav_menus( + array( + 'menu-1' => __( 'Primary', 'twentynineteen' ), + 'footer' => __( 'Footer Menu', 'twentynineteen' ), + 'social' => __( 'Social Links Menu', 'twentynineteen' ), + ) + ); + + /* + * 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', + 'script', + 'style', + ) + ); + + /** + * Add support for core custom logo. + * + * @link https://codex.wordpress.org/Theme_Logo + */ + add_theme_support( + 'custom-logo', + array( + 'height' => 190, + 'width' => 190, + 'flex-width' => false, + 'flex-height' => false, + ) + ); + + // Add theme support for selective refresh for widgets. + add_theme_support( 'customize-selective-refresh-widgets' ); + + // 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 custom editor font sizes. + add_theme_support( + 'editor-font-sizes', + array( + array( + 'name' => __( 'Small', 'twentynineteen' ), + 'shortName' => __( 'S', 'twentynineteen' ), + 'size' => 19.5, + 'slug' => 'small', + ), + array( + 'name' => __( 'Normal', 'twentynineteen' ), + 'shortName' => __( 'M', 'twentynineteen' ), + 'size' => 22, + 'slug' => 'normal', + ), + array( + 'name' => __( 'Large', 'twentynineteen' ), + 'shortName' => __( 'L', 'twentynineteen' ), + 'size' => 36.5, + 'slug' => 'large', + ), + array( + 'name' => __( 'Huge', 'twentynineteen' ), + 'shortName' => __( 'XL', 'twentynineteen' ), + 'size' => 49.5, + 'slug' => 'huge', + ), + ) + ); + + // Editor color palette. + add_theme_support( + 'editor-color-palette', + array( + array( + 'name' => 'default' === get_theme_mod( 'primary_color' ) ? __( 'Blue', 'twentynineteen' ) : null, + 'slug' => 'primary', + 'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 33 ), + ), + array( + 'name' => 'default' === get_theme_mod( 'primary_color' ) ? __( 'Dark Blue', 'twentynineteen' ) : null, + 'slug' => 'secondary', + 'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 23 ), + ), + array( + 'name' => __( 'Dark Gray', 'twentynineteen' ), + 'slug' => 'dark-gray', + 'color' => '#111', + ), + array( + 'name' => __( 'Light Gray', 'twentynineteen' ), + 'slug' => 'light-gray', + 'color' => '#767676', + ), + array( + 'name' => __( 'White', 'twentynineteen' ), + 'slug' => 'white', + 'color' => '#FFF', + ), + ) + ); + + // Add support for responsive embedded content. + add_theme_support( 'responsive-embeds' ); + } +endif; +add_action( 'after_setup_theme', 'twentynineteen_setup' ); + +/** + * Register widget area. + * + * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar + */ +function twentynineteen_widgets_init() { + + register_sidebar( + array( + 'name' => __( 'Footer', 'twentynineteen' ), + 'id' => 'sidebar-1', + 'description' => __( 'Add widgets here to appear in your footer.', 'twentynineteen' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ); + +} +add_action( 'widgets_init', 'twentynineteen_widgets_init' ); + +/** + * 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 Content width. + */ +function twentynineteen_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( 'twentynineteen_content_width', 640 ); +} +add_action( 'after_setup_theme', 'twentynineteen_content_width', 0 ); + +/** + * Enqueue scripts and styles. + */ +function twentynineteen_scripts() { + wp_enqueue_style( 'twentynineteen-style', get_stylesheet_uri(), array(), wp_get_theme()->get( 'Version' ) ); + + wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' ); + + if ( has_nav_menu( 'menu-1' ) ) { + wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '20181214', true ); + wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '20181231', true ); + } + + wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' ); + + if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { + wp_enqueue_script( 'comment-reply' ); + } +} +add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' ); + +/** + * Fix skip link focus in IE11. + * + * This does not enqueue the script because it is tiny and because it is only for IE11, + * thus it does not warrant having an entire dedicated blocking script being loaded. + * + * @link https://git.io/vWdr2 + */ +function twentynineteen_skip_link_focus_fix() { + // The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`. + ?> + + + + +