- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyseventeen/functions.php
r42228 r42343 60 60 61 61 // This theme uses wp_nav_menu() in two locations. 62 register_nav_menus( array( 63 'top' => __( 'Top Menu', 'twentyseventeen' ), 64 'social' => __( 'Social Links Menu', 'twentyseventeen' ), 65 ) ); 62 register_nav_menus( 63 array( 64 'top' => __( 'Top Menu', 'twentyseventeen' ), 65 'social' => __( 'Social Links Menu', 'twentyseventeen' ), 66 ) 67 ); 66 68 67 69 /* … … 69 71 * to output valid HTML5. 70 72 */ 71 add_theme_support( 'html5', array( 72 'comment-form', 73 'comment-list', 74 'gallery', 75 'caption', 76 ) ); 73 add_theme_support( 74 'html5', array( 75 'comment-form', 76 'comment-list', 77 'gallery', 78 'caption', 79 ) 80 ); 77 81 78 82 /* … … 81 85 * See: https://codex.wordpress.org/Post_Formats 82 86 */ 83 add_theme_support( 'post-formats', array( 84 'aside', 85 'image', 86 'video', 87 'quote', 88 'link', 89 'gallery', 90 'audio', 91 ) ); 87 add_theme_support( 88 'post-formats', array( 89 'aside', 90 'image', 91 'video', 92 'quote', 93 'link', 94 'gallery', 95 'audio', 96 ) 97 ); 92 98 93 99 // Add theme support for Custom Logo. 94 add_theme_support( 'custom-logo', array( 95 'width' => 250, 96 'height' => 250, 97 'flex-width' => true, 98 ) ); 100 add_theme_support( 101 'custom-logo', array( 102 'width' => 250, 103 'height' => 250, 104 'flex-width' => true, 105 ) 106 ); 99 107 100 108 // Add theme support for selective refresh for widgets. … … 104 112 * This theme styles the visual editor to resemble the theme style, 105 113 * specifically font, colors, and column width. 106 114 */ 107 115 add_editor_style( array( 'assets/css/editor-style.css', twentyseventeen_fonts_url() ) ); 108 116 109 117 // Define and register starter content to showcase the theme on new sites. 110 118 $starter_content = array( 111 'widgets' => array(119 'widgets' => array( 112 120 // Place three core-defined widgets in the sidebar area. 113 121 'sidebar-1' => array( … … 130 138 131 139 // Specify the core-defined pages to create and add custom thumbnails to some of them. 132 'posts' => array(140 'posts' => array( 133 141 'home', 134 'about' => array(142 'about' => array( 135 143 'thumbnail' => '{{image-sandwich}}', 136 144 ), 137 'contact' => array(145 'contact' => array( 138 146 'thumbnail' => '{{image-espresso}}', 139 147 ), 140 'blog' => array(148 'blog' => array( 141 149 'thumbnail' => '{{image-coffee}}', 142 150 ), … … 150 158 'image-espresso' => array( 151 159 'post_title' => _x( 'Espresso', 'Theme starter content', 'twentyseventeen' ), 152 'file' => 'assets/images/espresso.jpg', // URL relative to the template directory.160 'file' => 'assets/images/espresso.jpg', // URL relative to the template directory. 153 161 ), 154 162 'image-sandwich' => array( 155 163 'post_title' => _x( 'Sandwich', 'Theme starter content', 'twentyseventeen' ), 156 'file' => 'assets/images/sandwich.jpg',157 ), 158 'image-coffee' => array(164 'file' => 'assets/images/sandwich.jpg', 165 ), 166 'image-coffee' => array( 159 167 'post_title' => _x( 'Coffee', 'Theme starter content', 'twentyseventeen' ), 160 'file' => 'assets/images/coffee.jpg',168 'file' => 'assets/images/coffee.jpg', 161 169 ), 162 170 ), 163 171 164 172 // Default to a static front page and assign the front and posts pages. 165 'options' => array(166 'show_on_front' => 'page',167 'page_on_front' => '{{home}}',173 'options' => array( 174 'show_on_front' => 'page', 175 'page_on_front' => '{{home}}', 168 176 'page_for_posts' => '{{blog}}', 169 177 ), 170 178 171 179 // Set the front page section theme mods to the IDs of the core-registered pages. 172 'theme_mods' => array(180 'theme_mods' => array( 173 181 'panel_1' => '{{homepage-section}}', 174 182 'panel_2' => '{{about}}', … … 178 186 179 187 // Set up nav menus for each of the two areas registered in the theme. 180 'nav_menus' => array(188 'nav_menus' => array( 181 189 // Assign a menu to the "top" location. 182 'top' => array(183 'name' => __( 'Top Menu', 'twentyseventeen' ),190 'top' => array( 191 'name' => __( 'Top Menu', 'twentyseventeen' ), 184 192 'items' => array( 185 193 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. … … 192 200 // Assign a menu to the "social" location. 193 201 'social' => array( 194 'name' => __( 'Social Links Menu', 'twentyseventeen' ),202 'name' => __( 'Social Links Menu', 'twentyseventeen' ), 195 203 'items' => array( 196 204 'link_yelp', … … 312 320 */ 313 321 function twentyseventeen_widgets_init() { 314 register_sidebar( array( 315 'name' => __( 'Blog Sidebar', 'twentyseventeen' ), 316 'id' => 'sidebar-1', 317 'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'twentyseventeen' ), 318 'before_widget' => '<section id="%1$s" class="widget %2$s">', 319 'after_widget' => '</section>', 320 'before_title' => '<h2 class="widget-title">', 321 'after_title' => '</h2>', 322 ) ); 323 324 register_sidebar( array( 325 'name' => __( 'Footer 1', 'twentyseventeen' ), 326 'id' => 'sidebar-2', 327 'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ), 328 'before_widget' => '<section id="%1$s" class="widget %2$s">', 329 'after_widget' => '</section>', 330 'before_title' => '<h2 class="widget-title">', 331 'after_title' => '</h2>', 332 ) ); 333 334 register_sidebar( array( 335 'name' => __( 'Footer 2', 'twentyseventeen' ), 336 'id' => 'sidebar-3', 337 'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ), 338 'before_widget' => '<section id="%1$s" class="widget %2$s">', 339 'after_widget' => '</section>', 340 'before_title' => '<h2 class="widget-title">', 341 'after_title' => '</h2>', 342 ) ); 322 register_sidebar( 323 array( 324 'name' => __( 'Blog Sidebar', 'twentyseventeen' ), 325 'id' => 'sidebar-1', 326 'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'twentyseventeen' ), 327 'before_widget' => '<section id="%1$s" class="widget %2$s">', 328 'after_widget' => '</section>', 329 'before_title' => '<h2 class="widget-title">', 330 'after_title' => '</h2>', 331 ) 332 ); 333 334 register_sidebar( 335 array( 336 'name' => __( 'Footer 1', 'twentyseventeen' ), 337 'id' => 'sidebar-2', 338 'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ), 339 'before_widget' => '<section id="%1$s" class="widget %2$s">', 340 'after_widget' => '</section>', 341 'before_title' => '<h2 class="widget-title">', 342 'after_title' => '</h2>', 343 ) 344 ); 345 346 register_sidebar( 347 array( 348 'name' => __( 'Footer 2', 'twentyseventeen' ), 349 'id' => 'sidebar-3', 350 'description' => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ), 351 'before_widget' => '<section id="%1$s" class="widget %2$s">', 352 'after_widget' => '</section>', 353 'before_title' => '<h2 class="widget-title">', 354 'after_title' => '</h2>', 355 ) 356 ); 343 357 } 344 358 add_action( 'widgets_init', 'twentyseventeen_widgets_init' ); … … 358 372 } 359 373 360 $link = sprintf( '<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>', 374 $link = sprintf( 375 '<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>', 361 376 esc_url( get_permalink( get_the_ID() ) ), 362 377 /* translators: %s: Name of current post */ … … 408 423 <?php echo twentyseventeen_custom_colors_css(); ?> 409 424 </style> 410 <?php } 425 <?php 426 } 411 427 add_action( 'wp_head', 'twentyseventeen_colors_css_wrap' ); 412 428 … … 443 459 444 460 $twentyseventeen_l10n = array( 445 'quote' 461 'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ), 446 462 ); 447 463 448 464 if ( has_nav_menu( 'top' ) ) { 449 465 wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array( 'jquery' ), '1.0', true ); 450 $twentyseventeen_l10n['expand'] = __( 'Expand child menu', 'twentyseventeen' ); 451 $twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' ); 452 $twentyseventeen_l10n['icon'] = twentyseventeen_get_svg( array( 'icon' => 'angle-down', 'fallback' => true ) ); 466 $twentyseventeen_l10n['expand'] = __( 'Expand child menu', 'twentyseventeen' ); 467 $twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' ); 468 $twentyseventeen_l10n['icon'] = twentyseventeen_get_svg( 469 array( 470 'icon' => 'angle-down', 471 'fallback' => true, 472 ) 473 ); 453 474 } 454 475 … … 545 566 return is_home() ? '' : $template; 546 567 } 547 add_filter( 'frontpage_template', 568 add_filter( 'frontpage_template', 'twentyseventeen_front_page_template' ); 548 569 549 570 /**
Note: See TracChangeset
for help on using the changeset viewer.