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 http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in three locations. register_nav_menus( array( 'top-menu' => esc_html__( 'Top Menu', 'portage' ), 'primary-menu' => esc_html__( 'Primary Menu', 'portage' ), 'footer-menu' => esc_html__( 'Footer Menu', 'portage' ), ) ); /* * 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. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'portage_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); } endif; // portage_setup add_action( 'after_setup_theme', 'portage_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 portage_content_width() { $GLOBALS['content_width'] = apply_filters( 'portage_content_width', 620 ); } add_action( 'after_setup_theme', 'portage_content_width', 0 ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function portage_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'portage' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'portage_widgets_init' ); /** * Enqueue scripts and styles. */ function portage_scripts() { wp_enqueue_style( 'portage-googlefont', 'https://fonts.googleapis.com/css?family=IM+Fell+English:400,400italic', 'portage-style', wp_get_theme() -> get( 'Version' ), 'all' ); /* if ( !wp_style_is( 'font-awesome.min.css', 'enqueued' ) ) { wp_enqueue_style( 'portage-fa', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', 'portage-style', wp_get_theme() -> get( 'Version' ), 'all' ); } */ wp_enqueue_style( 'portage-style', get_stylesheet_uri() ); wp_enqueue_style( 'portage-menus', get_template_directory_uri() . '/styles/menus.css', array( 'portage-style' ), wp_get_theme() -> get( 'Version' ) ); wp_enqueue_style( 'portage-mobile', get_template_directory_uri() . '/styles/mobile.css', array( 'portage-style' ), wp_get_theme() -> get( 'Version' ), 'screen and (max-width: '. get_theme_mod( 'portage_mobile_breakpoint' ) . 'px)' ); wp_enqueue_style( 'portage-print', get_template_directory_uri() . '/styles/print.css', array( 'portage-style' ), wp_get_theme() -> get( 'Version' ), 'print' ); wp_enqueue_script( 'portage-menumaker', get_template_directory_uri() . '/js/menumaker.js', array( 'jquery' ), wp_get_theme() -> get( 'Version' ), true ); wp_enqueue_script( 'portage-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), wp_get_theme() -> get( 'Version' ), true ); wp_enqueue_script( 'portage-font-awesome', 'https://kit.fontawesome.com/7a45e15014.js', array(), wp_get_theme() -> get( 'Version' ), true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'portage_scripts' ); /** * Enable live changes in the customizer */ function portage_customizer_script() { wp_enqueue_script( 'portage-theme-customizer', get_template_directory_uri() . '/js/customizer.js', array(), wp_get_theme() -> get( 'Version' ), true ); } add_action( 'customize_preview_init', 'portage_customizer_script' ); // Change "read more" link on excerpts // codex.wordpress.org/Function_Reference/the_excerpt function portage_excerpt_more( $more ) { $text = get_theme_mod( 'portage_readmore', '…read more…' ); return ' ' . $text . ''; } add_filter( 'excerpt_more', 'portage_excerpt_more' ); // Add descriptions to main menu // http://www.wpbeginner.com/wp-themes/how-to-add-menu-descriptions-in-your-wordpress-themes/ /* class portage_Menu_With_Description extends Walker_Nav_Menu { function start_el(&$output, $item, $depth=0, $args = array(), $id=0) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $class_names = ' class="' . esc_attr( $class_names ) . '"'; $output .= $indent . '