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( 220, 140, true ); // Featured Post Main Thumbnail on the front page & single page template add_image_size( 'telescope-large-thumbnail', 1180, 500, true ); add_image_size( 'telescope-small-thumbnail', 60, 60, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'telescope' ), 'secondary' => esc_html__( 'Secondary Menu', 'telescope' ), 'footer' => esc_html__( 'Footer Menu', 'telescope' ), ) ); /* * 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', ) ); /* * JetPack Infinite Scroll */ add_theme_support( 'infinite-scroll', array( 'container' => 'recent-posts', 'type' => 'click', 'wrapper' => false, 'render' => 'telescope_infinite_scroll_render', 'footer' => false, ) ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, icons, and column width. */ add_editor_style( array( 'css/editor-style.css', telescope_fonts_url() ) ); } endif; // telescope_setup add_action( 'after_setup_theme', 'telescope_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 telescope_content_width() { $GLOBALS['content_width'] = apply_filters( 'telescope_content_width', 500 ); } add_action( 'after_setup_theme', 'telescope_content_width', 0 ); /* Custom Excerpt Length ==================================== */ function new_excerpt_length($length) { return 30; } add_filter('excerpt_length', 'new_excerpt_length'); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function telescope_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Main Sidebar', 'telescope' ), 'id' => 'sidebar-main', 'description' => esc_html__( 'This is the main sidebar area that appears on all pages', 'telescope' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Secondary Sidebar', 'telescope' ), 'id' => 'sidebar-secondary', 'description' => esc_html__( 'This is the small sidebar that is displayed on the front page and other archive pages', 'telescope' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer: Column 1', 'telescope' ), 'id' => 'sidebar-footer-1', 'description' => esc_html__( 'This is displayed in the footer of the website. By default has a width of 280px.', 'telescope' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer: Column 2', 'telescope' ), 'id' => 'sidebar-footer-2', 'description' => esc_html__( 'This is displayed in the footer of the website. By default has a width of 280px.', 'telescope' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer: Column 3', 'telescope' ), 'id' => 'sidebar-footer-3', 'description' => esc_html__( 'This is displayed in the footer of the website. By default has a width of 280px.', 'telescope' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer: Column 4', 'telescope' ), 'id' => 'sidebar-footer-4', 'description' => esc_html__( 'This is displayed in the footer of the website. By default has a width of 280px.', 'telescope' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'telescope_widgets_init' ); if ( ! function_exists( 'telescope_fonts_url' ) ) : /** * Register Google fonts for Telescope. * * Create your own telescope_fonts_url() function to override in a child theme. * * @since Telescope 1.0 * * @return string Google fonts URL for the theme. */ function telescope_fonts_url() { $fonts_url = ''; $fonts = array(); $subsets = 'latin,latin-ext'; /* translators: If there are characters in your language that are not supported by Merriweather, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Roboto font: on or off', 'telescope' ) ) { $fonts[] = 'Roboto:300,400,500,700'; } /* translators: If there are characters in your language that are not supported by Merriweather, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Montserrat font: on or off', 'telescope' ) ) { $fonts[] = 'Montserrat:400,700'; } /* 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. */ if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'telescope' ) ) { $fonts[] = 'Open+Sans:400,400italic,600,600italic,700'; } 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 telescope_scripts() { wp_enqueue_style( 'telescope-style', get_stylesheet_uri() ); // Add Genericons font. wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.3.1' ); wp_enqueue_script( 'mmenu', get_template_directory_uri() . '/js/jquery.mmenu.all.min.js', array('jquery'), null ); wp_enqueue_script( 'superfish', get_template_directory_uri() . '/js/superfish.min.js', array('jquery'), null ); wp_enqueue_script( 'flickity', get_template_directory_uri() . '/js/flickity.pkgd.js', array('jquery'), null ); wp_enqueue_script( 'telescope-script', get_template_directory_uri() . '/js/telescope.js', array( 'jquery' ), '20150825', true ); // Loads our default Google Webfont wp_enqueue_style( 'telescope-webfonts', '//fonts.googleapis.com/css?family=Roboto:300,400,500,700|Open+Sans:400,400italic,600,600italic,700|Montserrat:400,700', array(), null, null ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'telescope_scripts' ); /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /** * Load plugin enhancement file to display admin notices. */ require get_template_directory() . '/inc/plugin-enhancements.php'; /** * Modifies tag cloud widget arguments to have all tags in the widget same font size. * * @since Telescope 1.0 * * @param array $args Arguments for tag cloud widget. * @return array A new modified arguments. */ function telescope_widget_tag_cloud_args( $args ) { $args['largest'] = 1; $args['smallest'] = 1; $args['unit'] = 'em'; return $args; } add_filter( 'widget_tag_cloud_args', 'telescope_widget_tag_cloud_args' );