300, 'width' => 300, 'flex-height' => true, ) ); // Enable support for Post Thumbnail add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 1160, 9999 ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'brilliant' ), ) ); /* * 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', ) ); // Enable support for Post Formats add_theme_support( 'post-formats', array( 'image', 'link', 'gallery', 'quote', 'status', 'video', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'brilliant_custom_background_args', array( 'default-color' => 'f4f4f4', 'default-image' => '', ) ) ); // This theme styles the visual editor to resemble the theme style, add_editor_style( array( 'css/editor-style.css', brilliant_fonts_url() ) ); // Custom template tags for this theme require get_template_directory() . '/inc/template-tags.php'; // Theme Customizer require get_template_directory() . '/inc/customizer.php'; // Load Jetpack compatibility file require get_template_directory() . '/inc/jetpack.php'; } endif; add_action( 'after_setup_theme', 'brilliant_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 brilliant_content_width() { $GLOBALS['content_width'] = apply_filters( 'brilliant_content_width', 1160 ); } add_action( 'after_setup_theme', 'brilliant_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function brilliant_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'brilliant' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'brilliant' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area 1', 'brilliant' ), 'id' => 'footer-1', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area 2', 'brilliant' ), 'id' => 'footer-2', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area 3', 'brilliant' ), 'id' => 'footer-3', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area 4', 'brilliant' ), 'id' => 'footer-4', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'brilliant_widgets_init' ); if ( ! function_exists( 'brilliant_fonts_url' ) ) : /** * Register Google fonts. * * @return string Google fonts URL for the theme. */ function brilliant_fonts_url() { $fonts_url = ''; $fonts = array(); $subsets = 'latin,latin-ext'; /* translators: If there are characters in your language that are not supported by Raleway, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Raleway: on or off', 'brilliant' ) ) { $fonts[] = 'Raleway:400,700,300,400italic,700italic'; } /* translators: If there are characters in your language that are not supported by Playfair Display, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Playfair Display: on or off', 'brilliant' ) ) { $fonts[] = 'Playfair Display:400,700'; } /* translators: If there are characters in your language that are not supported by Crimson Text, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Crimson Text: on or off', 'brilliant' ) ) { $fonts[] = 'Crimson Text:400,400italic'; } /* translators: To add an additional character subset specific to your language, translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. */ $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'brilliant' ); if ( 'cyrillic' == $subset ) { $subsets .= ',cyrillic,cyrillic-ext'; } elseif ( 'greek' == $subset ) { $subsets .= ',greek,greek-ext'; } elseif ( 'devanagari' == $subset ) { $subsets .= ',devanagari'; } elseif ( 'vietnamese' == $subset ) { $subsets .= ',vietnamese'; } if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => urlencode( implode( '|', $fonts ) ), 'subset' => urlencode( $subsets ), ), '//fonts.googleapis.com/css' ); } return $fonts_url; } endif; /** * Enqueue scripts and styles. */ function brilliant_scripts() { // Add Google fonts, used in the main stylesheet. wp_enqueue_style( 'brilliant-fonts', brilliant_fonts_url(), array(), null ); // Add Icons font, used in the main stylesheet. wp_enqueue_style( 'brilliant-icons', get_template_directory_uri() . '/fonts/elegant-icons.css', array(), '1.0.0' ); // Theme stylesheet. wp_enqueue_style( 'brilliant-style', get_stylesheet_uri() ); wp_enqueue_script( 'brilliant-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'brilliant-script', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20160718', true ); } add_action( 'wp_enqueue_scripts', 'brilliant_scripts' ); /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function brilliant_body_classes( $classes ) { // Adds a class of group-blog to blogs with more than 1 published author. if ( is_multi_author() ) { $classes[] = 'group-blog'; } // Adds a class of hfeed to non-singular pages. if ( ! is_singular() ) { $classes[] = 'hfeed'; } return $classes; } add_filter( 'body_class', 'brilliant_body_classes' ); if ( ! function_exists( 'dl_custom_logo_url' ) ) : /** * Displays the optional custom logo URL. * Does nothing if the custom logo is not available. */ function dl_custom_logo_url() { if ( function_exists( 'the_custom_logo' ) ) { $custom_logo_id = get_theme_mod( 'custom_logo' ); $image = wp_get_attachment_image_src( $custom_logo_id , 'full' ); echo $image[0]; } } endif; /** * Filter the except length to 15 characters. * */ function dl_custom_excerpt_length( $length ) { return 50; } add_filter( 'excerpt_length', 'dl_custom_excerpt_length', 999 ); /** * Filter the excerpt "read more" string. * * @param string $more "Read more" excerpt string. * @return string (Maybe) modified "read more" excerpt string. */ function dl_excerpt_more( $more ) { return '...'; } add_filter( 'excerpt_more', 'dl_excerpt_more' ); /** * Custom excerpt */ function dl_excerpt( $num ) { global $post; $limit = $num+1; $excerpt = explode(' ', get_the_excerpt(), $limit); array_pop($excerpt); $excerpt = implode(" ",$excerpt); echo $excerpt . '...'; } /** * Prints Credits in the Footer */ function dl_credits() { $website_credits = ''; $website_author = get_bloginfo('name'); $website_date = date ('Y'); $website_credits = esc_attr( '© ' . $website_date . ' ' . $website_author ); echo $website_credits; }