functions.php 2.0 KB

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