functions.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. if ( ! function_exists( 'cc_setup' ) ) :
  3. function cc_setup() {
  4. add_theme_support( 'automatic-feed-links' );
  5. add_theme_support( 'title-tag' );
  6. add_theme_support( 'post-thumbnails' );
  7. register_nav_menus( array(
  8. 'primary' => esc_html__( 'Primary', 'cc' ),
  9. ) );
  10. add_theme_support( 'html5', array(
  11. 'search-form',
  12. 'comment-form',
  13. 'comment-list',
  14. 'gallery',
  15. 'caption',
  16. ) );
  17. add_theme_support( 'post-formats', array(
  18. 'aside',
  19. 'image',
  20. 'video',
  21. 'quote',
  22. 'link',
  23. ) );
  24. }
  25. endif;
  26. add_action( 'after_setup_theme', 'cc_setup' );
  27. function cc_content_width() {
  28. $GLOBALS['content_width'] = apply_filters( 'cc_content_width', 640 );
  29. }
  30. add_action( 'after_setup_theme', 'cc_content_width', 0 );
  31. function cc_widgets_init() {
  32. register_sidebar( array(
  33. 'name' => esc_html__( 'Sidebar', 'cc' ),
  34. 'id' => 'sidebar-1',
  35. 'description' => '',
  36. 'before_widget' => '<section id="%1$s" class="widget %2$s">',
  37. 'after_widget' => '</section>',
  38. 'before_title' => '<h2 class="widget-title">',
  39. 'after_title' => '</h2>',
  40. ) );
  41. }
  42. add_action( 'widgets_init', 'cc_widgets_init' );
  43. function cc_scripts() {
  44. wp_enqueue_style( 'cc-style', get_stylesheet_uri() );
  45. wp_enqueue_script( 'cc-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
  46. wp_enqueue_script( 'cc-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
  47. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  48. wp_enqueue_script( 'comment-reply' );
  49. }
  50. }
  51. add_action( 'wp_enqueue_scripts', 'cc_scripts' );
  52. require get_template_directory() . '/inc/template-tags.php';