Advertisement
Guest User

functions.php

a guest
Nov 22nd, 2015
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. <?php
  2. /**
  3. * MaxS functions and definitions.
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/theme-functions/
  6. *
  7. * @package MaxS
  8. */
  9.  
  10. if ( ! function_exists( 'bootstrap_based_theme_setup' ) ) :
  11. /**
  12. * Sets up theme defaults and registers support for various WordPress features.
  13. *
  14. * Note that this function is hooked into the after_setup_theme hook, which
  15. * runs before the init hook. The init hook is too late for some features, such
  16. * as indicating support for post thumbnails.
  17. */
  18. function bootstrap_based_theme_setup() {
  19. /*
  20. * Make theme available for translation.
  21. * Translations can be filed in the /languages/ directory.
  22. * If you're building a theme based on MaxS, use a find and replace
  23. * to change 'bootstrap-based-theme' to the name of your theme in all the template files.
  24. */
  25. load_theme_textdomain( 'bootstrap-based-theme', get_template_directory() . '/languages' );
  26.  
  27. // Add default posts and comments RSS feed links to head.
  28. add_theme_support( 'automatic-feed-links' );
  29.  
  30. /*
  31. * Let WordPress manage the document title.
  32. * By adding theme support, we declare that this theme does not use a
  33. * hard-coded <title> tag in the document head, and expect WordPress to
  34. * provide it for us.
  35. */
  36. add_theme_support( 'title-tag' );
  37.  
  38. /*
  39. * Enable support for Post Thumbnails on posts and pages.
  40. *
  41. * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
  42. */
  43. add_theme_support( 'post-thumbnails' );
  44.  
  45. // This theme uses wp_nav_menu() in one location.
  46. register_nav_menus( array(
  47. 'primary' => esc_html__( 'Primary Menu', 'bootstrap-based-theme' ),
  48. ) );
  49.  
  50. /*
  51. * Switch default core markup for search form, comment form, and comments
  52. * to output valid HTML5.
  53. */
  54. add_theme_support( 'html5', array(
  55. 'search-form',
  56. 'comment-form',
  57. 'comment-list',
  58. 'gallery',
  59. 'caption',
  60. ) );
  61.  
  62. /*
  63. * Enable support for Post Formats.
  64. * See https://developer.wordpress.org/themes/functionality/post-formats/
  65. */
  66. add_theme_support( 'post-formats', array(
  67. 'aside',
  68. 'image',
  69. 'video',
  70. 'quote',
  71. 'link',
  72. ) );
  73.  
  74. // Set up the WordPress core custom background feature.
  75. add_theme_support( 'custom-background', apply_filters( 'bootstrap_based_theme_custom_background_args', array(
  76. 'default-color' => 'ffffff',
  77. 'default-image' => '',
  78. ) ) );
  79. }
  80. endif; // bootstrap_based_theme_setup
  81. add_action( 'after_setup_theme', 'bootstrap_based_theme_setup' );
  82.  
  83. /**
  84. * Set the content width in pixels, based on the theme's design and stylesheet.
  85. *
  86. * Priority 0 to make it available to lower priority callbacks.
  87. *
  88. * @global int $content_width
  89. */
  90. function bootstrap_based_theme_content_width() {
  91. $GLOBALS['content_width'] = apply_filters( 'bootstrap_based_theme_content_width', 640 );
  92. }
  93. add_action( 'after_setup_theme', 'bootstrap_based_theme_content_width', 0 );
  94.  
  95. /**
  96. * Register widget area.
  97. *
  98. * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
  99. */
  100. function bootstrap_based_theme_widgets_init() {
  101. register_sidebar( array(
  102. 'name' => esc_html__( 'Sidebar', 'bootstrap-based-theme' ),
  103. 'id' => 'sidebar-1',
  104. 'description' => '',
  105. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  106. 'after_widget' => '</aside>',
  107. 'before_title' => '<h2 class="widget-title">',
  108. 'after_title' => '</h2>',
  109. ) );
  110. }
  111. add_action( 'widgets_init', 'bootstrap_based_theme_widgets_init' );
  112.  
  113. /**
  114. * Enqueue scripts and styles.
  115. */
  116. function bootstrap_based_theme_scripts() {
  117. wp_enqueue_style( 'bootstrap-based-theme-style', get_stylesheet_uri() );
  118.  
  119. wp_enqueue_script( 'bootstrap-based-theme-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
  120.  
  121. wp_enqueue_script( 'bootstrap-based-theme-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
  122.  
  123. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  124. wp_enqueue_script( 'comment-reply' );
  125. }
  126. wp_register_script( 'bootstrap-js', get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js', array( 'jquery' ), '3.3.5', true );
  127.  
  128. wp_register_style( ‚bootstrap-css‘, get_template_directory_uri() . ‚/bootstrap/css/bootstrap.min.css‘, array(), ‚3.3.5‘, ‚all‘ );
  129.  
  130. wp_enqueue_script( ‚bootstrap-js‘ );
  131.  
  132. wp_enqueue_style( ‚bootstrap-css‘ );
  133. }
  134. add_action( 'wp_enqueue_scripts', 'bootstrap_based_theme_scripts' );
  135. remove_filter( 'the_content', 'wpautop' );
  136. /**
  137. * Implement the Custom Header feature.
  138. */
  139. require get_template_directory() . '/inc/custom-header.php';
  140.  
  141. /**
  142. * Custom template tags for this theme.
  143. */
  144. require get_template_directory() . '/inc/template-tags.php';
  145.  
  146. /**
  147. * Custom functions that act independently of the theme templates.
  148. */
  149. require get_template_directory() . '/inc/extras.php';
  150.  
  151. /**
  152. * Customizer additions.
  153. */
  154. require get_template_directory() . '/inc/customizer.php';
  155.  
  156. /**
  157. * Load Jetpack compatibility file.
  158. */
  159. require get_template_directory() . '/inc/jetpack.php';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement