firsttec_setup

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

Description

firsttec_setup(); 

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.

To override firsttec_setup() in a child theme, add your own firsttec_setup to your child theme's functions.php file.


Usage

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

Defined (1)

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

/functions.php  
  1. function firsttec_setup() { 
  2.  
  3. // This theme styles the visual editor with editor-style.css to match the theme style. 
  4. add_editor_style(); 
  5.  
  6. // Post Format support. You can also use the legacy "gallery" or "asides" (note the plural) categories. 
  7. add_theme_support( 'post-formats', array( 'aside', 'gallery' ) ); 
  8.  
  9. // This theme uses post thumbnails 
  10. add_theme_support( 'post-thumbnails' ); 
  11.  
  12. // Add default posts and comments RSS feed links to head 
  13. add_theme_support( 'automatic-feed-links' ); 
  14.  
  15. // Make theme available for translation 
  16. // Translations can be filed in the /languages/ directory 
  17. load_theme_textdomain( 'firsttec', TEMPLATEPATH . '/languages' ); 
  18.  
  19. $locale = get_locale(); 
  20. $locale_file = TEMPLATEPATH . "/languages/$locale.php"; 
  21. if ( is_readable( $locale_file ) ) 
  22. require_once( $locale_file ); 
  23.  
  24. // This theme uses wp_nav_menu() in one location. 
  25. register_nav_menus( array( 
  26. 'primary' => __( 'Primary Navigation', 'firsttec' ),  
  27. ) ); 
  28.  
  29. // This theme allows users to set a custom background 
  30. add_custom_background(); 
  31.  
  32. // Your changeable header business starts here 
  33. if ( ! defined( 'HEADER_TEXTCOLOR' ) ) 
  34. define( 'HEADER_TEXTCOLOR', '' ); 
  35.  
  36. // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI. 
  37. if ( ! defined( 'HEADER_IMAGE' ) ) 
  38. define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' ); 
  39.  
  40. // The height and width of your custom header. You can hook into the theme's own filters to change these values. 
  41. // Add a filter to firsttec_header_image_width and firsttec_header_image_height to change these values. 
  42. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'firsttec_header_image_width', 940 ) ); 
  43. define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'firsttec_header_image_height', 198 ) ); 
  44.  
  45. // We'll be using post thumbnails for custom header images on posts and pages. 
  46. // We want them to be 940 pixels wide by 198 pixels tall. 
  47. // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. 
  48. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); 
  49.  
  50. // Don't support text inside the header image. 
  51. if ( ! defined( 'NO_HEADER_TEXT' ) ) 
  52. define( 'NO_HEADER_TEXT', true ); 
  53.  
  54. // Add a way for the custom header to be styled in the admin panel that controls 
  55. // custom headers. See firsttec_admin_header_style(), below. 
  56. add_custom_image_header( '', 'firsttec_admin_header_style' ); 
  57.  
  58. // ... and thus ends the changeable header business. 
  59.  
  60. // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. 
  61. register_default_headers( array( 
  62. 'berries' => array( 
  63. 'url' => '%s/images/headers/berries.jpg',  
  64. 'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg',  
  65. /** translators: header image description */ 
  66. 'description' => __( 'Berries', 'firsttec' ) 
  67. ),  
  68. 'cherryblossom' => array( 
  69. 'url' => '%s/images/headers/cherryblossoms.jpg',  
  70. 'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',  
  71. /** translators: header image description */ 
  72. 'description' => __( 'Cherry Blossoms', 'firsttec' ) 
  73. ),  
  74. 'concave' => array( 
  75. 'url' => '%s/images/headers/concave.jpg',  
  76. 'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg',  
  77. /** translators: header image description */ 
  78. 'description' => __( 'Concave', 'firsttec' ) 
  79. ),  
  80. 'fern' => array( 
  81. 'url' => '%s/images/headers/fern.jpg',  
  82. 'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',  
  83. /** translators: header image description */ 
  84. 'description' => __( 'Fern', 'firsttec' ) 
  85. ),  
  86. 'forestfloor' => array( 
  87. 'url' => '%s/images/headers/forestfloor.jpg',  
  88. 'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',  
  89. /** translators: header image description */ 
  90. 'description' => __( 'Forest Floor', 'firsttec' ) 
  91. ),  
  92. 'inkwell' => array( 
  93. 'url' => '%s/images/headers/inkwell.jpg',  
  94. 'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',  
  95. /** translators: header image description */ 
  96. 'description' => __( 'Inkwell', 'firsttec' ) 
  97. ),  
  98. 'path' => array( 
  99. 'url' => '%s/images/headers/path.jpg',  
  100. 'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg',  
  101. /** translators: header image description */ 
  102. 'description' => __( 'Path', 'firsttec' ) 
  103. ),  
  104. 'sunset' => array( 
  105. 'url' => '%s/images/headers/sunset.jpg',  
  106. 'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',  
  107. /** translators: header image description */ 
  108. 'description' => __( 'Sunset', 'firsttec' ) 
  109. ) );