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' ); add_theme_support( "responsive-embeds" ); add_image_size( 'music-center-home-blog', 400, 300, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'music-center' ), 'social' => esc_html__( 'Social', 'music-center' ), ) ); /* * 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', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'music_center_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); add_theme_support( 'custom-header', array( 'default-image' => '%s/assets/img/header-image.jpg', 'default-text-color' => '000', 'width' => 1332, /* 16:9 Aspect Ratio */ 'height' => 749, ) ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 100, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, and column width. */ add_editor_style( array( 'assets/css/editor-style.css', music_center_fonts_url() ) ); // Gutenberg support add_theme_support( 'editor-color-palette', array( array( 'name' => esc_html__( 'Blue', 'music-center' ), 'slug' => 'blue', 'color' => '#2c7dfa', ), array( 'name' => esc_html__( 'Green', 'music-center' ), 'slug' => 'green', 'color' => '#07d79c', ), array( 'name' => esc_html__( 'Orange', 'music-center' ), 'slug' => 'orange', 'color' => '#ff8737', ), array( 'name' => esc_html__( 'Black', 'music-center' ), 'slug' => 'black', 'color' => '#2f3633', ), array( 'name' => esc_html__( 'Grey', 'music-center' ), 'slug' => 'grey', 'color' => '#82868b', ), )); add_theme_support( 'align-wide' ); add_theme_support( 'editor-font-sizes', array( array( 'name' => esc_html__( 'small', 'music-center' ), 'shortName' => esc_html__( 'S', 'music-center' ), 'size' => 12, 'slug' => 'small' ), array( 'name' => esc_html__( 'regular', 'music-center' ), 'shortName' => esc_html__( 'M', 'music-center' ), 'size' => 16, 'slug' => 'regular' ), array( 'name' => esc_html__( 'larger', 'music-center' ), 'shortName' => esc_html__( 'L', 'music-center' ), 'size' => 36, 'slug' => 'larger' ), array( 'name' => esc_html__( 'huge', 'music-center' ), 'shortName' => esc_html__( 'XL', 'music-center' ), 'size' => 48, 'slug' => 'huge' ) )); add_theme_support('editor-styles'); add_theme_support( 'wp-block-styles' ); } endif; add_action( 'after_setup_theme', 'music_center_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 music_center_content_width() { $GLOBALS['content_width'] = apply_filters( 'music_center_content_width', 900 ); } add_action( 'after_setup_theme', 'music_center_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function music_center_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Primary Sidebar', 'music-center' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'music-center' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); for ( $i=1; $i <= 4; $i++ ) { register_sidebar( array( 'name' => esc_html__( 'Footer Widget Area ', 'music-center' ) . $i, 'id' => 'footer-' . $i, 'description' => esc_html__( 'Add widgets here.', 'music-center' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } } add_action( 'widgets_init', 'music_center_widgets_init' ); /** * Register custom fonts. */ function music_center_fonts_url() { $fonts_url = ''; $font_families = array(); /* * Translators: If there are characters in your language that are not * supported by Montserrat, translate this to 'off'. Do not translate * into your own language. */ $lato_sans = _x( 'on', 'Lato font: on or off', 'music-center' ); if ( 'off' !== $lato_sans ) { $font_families[] = 'Lato:400,700'; } $mulish_sans = _x( 'on', 'Mulish font: on or off', 'music-center' ); if ( 'off' !== $mulish_sans ) { $font_families[] = 'Mulish:400,600,700'; } $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); return esc_url_raw( $fonts_url ); } /** * Enqueue scripts and styles. */ function music_center_scripts() { // Add custom fonts, used in the main stylesheet. wp_enqueue_style( 'music-center-fonts', music_center_fonts_url(), array(), null ); //slick.css wp_enqueue_style( 'slick', get_theme_file_uri() . '/assets/css/slick.css', '', '1.8.0' ); //slick-theme.css wp_enqueue_style( 'slick-theme', get_theme_file_uri() . '/assets/css/slick-theme.css', '', '1.8.0' ); //magnific-popup.css wp_enqueue_style( 'magnific-popup', get_theme_file_uri() . '/assets/css/magnific-popup.css', '', '1.8.0' ); //font-awesome.css wp_enqueue_style( 'font-awesome', get_theme_file_uri() . '/assets/css/font-awesome.css', '', '4.7.0' ); // blocks wp_enqueue_style( 'music-center-blocks', get_template_directory_uri() . '/assets/css/blocks.css' ); wp_enqueue_style( 'music-center-style', get_stylesheet_uri() ); // blue wp_enqueue_style( 'music-center-blue', get_template_directory_uri() . '/assets/css/blue.css' ); //slick.js wp_enqueue_script( 'slick-jquery', get_theme_file_uri( '/assets/js/slick.js' ), array( 'jquery' ), '20151215', true ); // matchHeight wp_enqueue_script( 'jquery-matchHeight', get_template_directory_uri() . '/assets/js/jquery.matchHeight.js', array( 'jquery' ), true ); //magnific-popup.js wp_enqueue_script( 'magnific-popup', get_theme_file_uri( '/assets/js/jquery.magnific-popup.js' ), array( 'jquery' ), '20151215', true ); //packery.pkgd.js wp_enqueue_script( 'packery-pkgd', get_theme_file_uri( '/assets/js/packery.pkgd.js' ), array( 'jquery' ), '20151215', true ); wp_enqueue_script( 'music-center-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array(), '20151215', true ); wp_enqueue_script( 'music-center-skip-link-focus-fix', get_theme_file_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151215', true ); wp_enqueue_script( 'music-center-custom', get_theme_file_uri( '/assets/js/custom.js' ), array( 'jquery' ), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'music_center_scripts' ); /** * Enqueue editor styles for Gutenberg * * @since music-center 1.0.0 */ function music_center_block_editor_styles() { // Block styles. wp_enqueue_style( 'music-center-block-editor-style', get_theme_file_uri( '/assets/css/editor-blocks.css' ) ); // Add custom fonts. wp_enqueue_style( 'music-center-fonts', music_center_fonts_url(), array(), null ); } add_action( 'enqueue_block_editor_assets', 'music_center_block_editor_styles' ); /** * Custom template tags for this theme. */ require get_parent_theme_file_path( '/inc/template-tags.php' ); /** * Functions which enhance the theme by hooking into WordPress. */ require get_parent_theme_file_path( '/inc/template-functions.php' ); /** * Customizer additions. */ require get_parent_theme_file_path( '/inc/customizer/customizer.php' ); /** * SVG icons functions and filters. */ require get_parent_theme_file_path( '/inc/icon-functions.php' ); /** * Breadcrumb trail class. */ require get_parent_theme_file_path( '/inc/class-breadcrumb-trail.php' ); /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_parent_theme_file_path() . '/inc/jetpack.php'; } /** * Metabox */ require get_parent_theme_file_path( '/inc/metabox.php' ); /** * TGMPA call */ require get_parent_theme_file_path( '/inc/tgmpa/call.php' ); require get_parent_theme_file_path( '/inc/custom-style.php' ); /** * Enqueue admin css. * @return [type] [description] */ function music_center_load_custom_wp_admin_style( $hook ) { wp_register_style( 'music-center-admin', get_theme_file_uri( 'assets/css/music-center-admin.css' ), false, '1.0.0' ); wp_enqueue_style( 'music-center-admin' ); } add_action( 'admin_enqueue_scripts', 'music_center_load_custom_wp_admin_style' ); /** * * Reset all setting to default. * */ function music_center_reset_settings() { $reset_settings = get_theme_mod( 'music_center_reset_settings', false ); if ( $reset_settings ) { remove_theme_mods(); } } add_action( 'customize_save_after', 'music_center_reset_settings' ); if ( ! function_exists( 'music_center_exclude_sticky_posts' ) ) { function music_center_exclude_sticky_posts( $query ) { if ( ! is_admin() && $query->is_main_query() && $query->is_home() ) { $sticky_posts = get_option( 'sticky_posts' ); if ( ! empty( $sticky_posts ) ) { $query->set('post__not_in', $sticky_posts ); } $query->set('ignore_sticky_posts', true ); } } } add_action( 'pre_get_posts', 'music_center_exclude_sticky_posts' );