twentyfourteen_setup

Twenty Fourteen setup.

Description

twentyfourteen_setup(); 

Set up theme defaults and registers support for various WordPress features.

Note that this function is hooked into the after_setup_theme hook, which runs before the init hook. The init hook is too late for some features, such as indicating support post thumbnails.


Usage

  1. if ( !function_exists( 'twentyfourteen_setup' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = twentyfourteen_setup(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function twentyfourteen_setup() { 
  2.  
  3. /** 
  4. * Make Twenty Fourteen available for translation. 
  5. * Translations can be added to the /languages/ directory. 
  6. * If you're building a theme based on Twenty Fourteen, use a find and 
  7. * replace to change 'twentyfourteen' to the name of your theme in all 
  8. * template files. 
  9. */ 
  10. load_theme_textdomain( 'twentyfourteen', get_template_directory() . '/languages' ); 
  11.  
  12. // This theme styles the visual editor to resemble the theme style. 
  13. add_editor_style( array( 'css/editor-style.css', twentyfourteen_font_url() ) ); 
  14.  
  15. // Add RSS feed links to <head> for posts and comments. 
  16. add_theme_support( 'automatic-feed-links' ); 
  17.  
  18. // Enable support for Post Thumbnails, and declare two sizes. 
  19. add_theme_support( 'post-thumbnails' ); 
  20. set_post_thumbnail_size( 672, 372, true ); 
  21. add_image_size( 'twentyfourteen-full-width', 1038, 576, true ); 
  22.  
  23. // This theme uses wp_nav_menu() in two locations. 
  24. register_nav_menus( array( 
  25. 'primary' => __( 'Top primary menu', 'twentyfourteen' ),  
  26. 'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ),  
  27. ) ); 
  28.  
  29. /** 
  30. * Switch default core markup for search form, comment form, and comments 
  31. * to output valid HTML5. 
  32. */ 
  33. add_theme_support( 'html5', array( 
  34. 'search-form', 'comment-form', 'comment-list',  
  35. ) ); 
  36.  
  37. /** 
  38. * Enable support for Post Formats. 
  39. * See http://codex.wordpress.org/Post_Formats 
  40. */ 
  41. add_theme_support( 'post-formats', array( 
  42. 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery',  
  43. ) ); 
  44.  
  45. // This theme allows users to set a custom background. 
  46. add_theme_support( 'custom-background', apply_filters( 'twentyfourteen_custom_background_args', array( 
  47. 'default-color' => 'f5f5f5',  
  48. ) ) ); 
  49.  
  50. // Add support for featured content. 
  51. add_theme_support( 'featured-content', array( 
  52. 'featured_content_filter' => 'twentyfourteen_get_featured_posts',  
  53. 'max_posts' => 6,  
  54. ) ); 
  55.  
  56. // This theme uses its own gallery styles. 
  57. add_filter( 'use_default_gallery_style', '__return_false' );