cwp_megar_setup

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

Description

cwp_megar_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.


Usage

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

Defined (1)

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

/functions.php  
  1. function cwp_megar_setup() { 
  2.  
  3. /** 
  4. * Make theme available for translation 
  5. * Translations can be filed in the /languages/ directory 
  6. * If you're building a theme based on CWP-MegaR, use a find and replace 
  7. * to change 'cwp-megar' to the name of your theme in all the template files 
  8. */ 
  9. load_theme_textdomain( 'cwp-megar', get_template_directory() . '/languages' ); 
  10.  
  11. /** 
  12. * Add default posts and comments RSS feed links to head 
  13. */ 
  14. add_theme_support( 'automatic-feed-links' ); 
  15.  
  16. /** 
  17. * Enable support for Post Thumbnails on posts and pages 
  18. * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails 
  19. */ 
  20. //add_theme_support( 'post-thumbnails' ); 
  21.  
  22. /** 
  23. * This theme uses wp_nav_menu() in one location. 
  24. */ 
  25. register_nav_menus( array( 
  26. 'primary' => __( 'Primary Menu', 'cwp-megar' ),  
  27. 'footer' => __( 'Footer Menu', 'cwp-megar' ),  
  28. 'sidebar_menu' => __( 'Sidebar menu', 'cwp-megar' ),  
  29. ) ); 
  30.  
  31. /** 
  32. * Enable support for Post Formats 
  33. */ 
  34. add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) ); 
  35.  
  36. /** 
  37. * Setup the WordPress core custom background feature. 
  38. */ 
  39. add_theme_support( 'custom-background', apply_filters( 'cwp_megar_custom_background_args', array( 
  40. 'default-color' => 'fefefe',  
  41. 'default-image' => '',  
  42. ) ) ); 
  43.  
  44.  
  45. /** 
  46. * Implement the Custom Header feature. 
  47. */ 
  48. //require get_template_directory() . '/inc/custom-header.php'; 
  49. $args = array( 
  50. 'width' => 980,  
  51. 'height' => 60,  
  52. 'default-image' => '',  
  53. 'uploads' => true,  
  54. ); 
  55. add_theme_support( 'custom-header', $args ); 
  56.  
  57. /** 
  58. * Custom template tags for this theme. 
  59. */ 
  60. require get_template_directory() . '/inc/template-tags.php'; 
  61.  
  62. /** 
  63. * Custom functions that act independently of the theme templates. 
  64. */ 
  65. require get_template_directory() . '/inc/extras.php'; 
  66.  
  67. /** 
  68. * Customizer additions. 
  69. */ 
  70. require get_template_directory() . '/inc/customizer.php'; 
  71.  
  72. /** 
  73. * Load Jetpack compatibility file. 
  74. */ 
  75. require get_template_directory() . '/inc/jetpack.php'; 
  76.  
  77. /** 
  78. * Enabling Support for Post Thumbnails. 
  79. */ 
  80. add_theme_support( 'post-thumbnails' );  
  81.  
  82. /** 
  83. * Banner widget. 
  84. */ 
  85. $widget_banner = locate_template( 'widgets/banner-widget/banner-widget.php', TRUE, TRUE ); 
  86.  
  87. /** 
  88. * Facebook like box widget. 
  89. */ 
  90. $widget_facebook_box = locate_template( 'widgets/facebook-like-box/fb-like-box.php', TRUE, TRUE ); 
  91.