functions.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. add_filter( 'pre_http_request', '__return_true', 100 ); //REMOVE All REMOTE CAllS
  3. if ( ! function_exists( 'dw_setup' ) ):
  4. function dw_setup() {
  5. require( get_template_directory() . '/inc/template.php' );
  6. require( get_template_directory() . '/inc/tweaks.php' );
  7. require get_template_directory() . '/inc/utils.php';
  8. }
  9. endif;
  10. add_action( 'after_setup_theme', 'dw_setup' );
  11. add_theme_support( 'automatic-feed-links' );
  12. add_theme_support( 'menus' );
  13. add_theme_support( 'post-thumbnails' );
  14. set_post_thumbnail_size( 150, 150, true );
  15. add_image_size( 'post-large', 770, 577, true );
  16. function dw_scripts() {
  17. global $post;
  18. wp_enqueue_style( 'style', get_stylesheet_uri() );
  19. //wp_enqueue_style( 'style-o-min', get_template_directory_uri() . '/css/style-o.min.css');
  20. //wp_enqueue_style( 'style-o', get_template_directory_uri() . '/css/style-o.css');
  21. //wp_enqueue_style( 'style-o', get_template_directory_uri() . '/css/style-o.min.css');
  22. wp_enqueue_style( 'boot', get_template_directory_uri() . '/css/bootstrap.css');
  23. wp_enqueue_style( 'jasny', get_template_directory_uri() . '/css/jasny-bootstrap.css');
  24. wp_enqueue_style( 'font', get_template_directory_uri() . '/css/font-awesome.css');
  25. wp_enqueue_style( 'cal', get_template_directory_uri() . '/css/fullcalendar.css');
  26. wp_enqueue_style( 'ani', get_template_directory_uri() . '/css/animate.css');
  27. wp_deregister_script('jquery');
  28. wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-2.1.1.min.js', array(), false, true);
  29. if ( is_front_page() || is_home() ) {
  30. //wp_enqueue_style( 'style-min', get_template_directory_uri() . '/css/style.min.css');
  31. wp_enqueue_style( 'boot', get_template_directory_uri() . '/css/bootstrap.css');
  32. wp_enqueue_style( 'jasny', get_template_directory_uri() . '/css/jasny-bootstrap.css');
  33. wp_enqueue_style( 'font', get_template_directory_uri() . '/css/font-awesome.css');
  34. wp_enqueue_style( 'cal', get_template_directory_uri() . '/css/fullcalendar.css');
  35. wp_enqueue_style( 'ani', get_template_directory_uri() . '/css/animate.css');
  36. wp_enqueue_script( 'modern', get_template_directory_uri() . '/js/modernizr.js', 'jquery', '', true );
  37. wp_enqueue_script( 'boostrap', get_template_directory_uri() . '/js/bootstrap.min.js', 'jquery', '', true );
  38. wp_enqueue_script( 'offcanvas', get_template_directory_uri() . '/js/jasny-bootstrap.js', 'jquery', '', true );
  39. wp_enqueue_script( 'time', get_template_directory_uri() . '/js/moment.min.js', 'jquery', '', true );
  40. wp_enqueue_script( 'cal', get_template_directory_uri() . '/js/fullcalendar.min.js', 'jquery', '', true );
  41. wp_enqueue_script( 'valid', get_template_directory_uri() . '/js/validate.min.js', 'jquery', '', true );
  42. wp_enqueue_script( 'smooth', get_template_directory_uri() . '/js/smooth.js', 'jquery', '', true );
  43. wp_enqueue_script( 'scripts', get_template_directory_uri() . '/js/scripts.js', 'jquery', '', true );
  44. //wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js', 'jquery', '', true );
  45. //wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/script.min.js', 'jquery', '', true );
  46. wp_enqueue_script( 'init', get_template_directory_uri() . '/js/init.js', 'jquery', '', true );
  47. //wp_enqueue_script( 'init', get_template_directory_uri() . '/js/init.min.js', 'jquery', '', true );
  48. }
  49. else {
  50. wp_enqueue_script( 'scripts-o', get_template_directory_uri() . '/js/script-o.js', 'jquery', '', true );
  51. //wp_enqueue_script( 'scripts', get_template_directory_uri() . '/js/script-o.min.js', 'jquery', '', true );
  52. wp_enqueue_script( 'init-o', get_template_directory_uri() . '/js/init-o.js', 'jquery', '', true );
  53. //wp_enqueue_script( 'init', get_template_directory_uri() . '/js/init-o.min.js', 'jquery', '', true );
  54. }
  55. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  56. wp_enqueue_script( 'comment-reply' );
  57. }
  58. if ( is_page('notebook') || is_archive() || is_search() ) {
  59. global $wp_rewrite;
  60. wp_enqueue_script( '_s_backbone-loop', get_template_directory_uri() . '/js/loop.js', array( 'jquery', 'backbone', 'underscore', 'wp-api' ), '1.0', true );
  61. $queried_object = get_queried_object();
  62. $local = array(
  63. 'loopType' => 'home',
  64. 'queriedObject' => $queried_object,
  65. 'pathInfo' => array(
  66. 'author_permastruct' => $wp_rewrite->get_author_permastruct(),
  67. 'host' => preg_replace( '#^http(s)?://#i', '', untrailingslashit( get_option( 'home' ) ) ),
  68. 'path' => _s_backbone_get_request_path(),
  69. 'use_trailing_slashes' => $wp_rewrite->use_trailing_slashes,
  70. 'parameters' => _s_backbone_get_request_parameters(),
  71. ),
  72. );
  73. if ( is_category() || is_tag() || is_tax() ) {
  74. $local['loopType'] = 'archive';
  75. $local['taxonomy'] = get_taxonomy( $queried_object->taxonomy );
  76. } elseif ( is_search() ) {
  77. $local['loopType'] = 'search';
  78. $local['searchQuery'] = get_search_query();
  79. } elseif ( is_author() ) {
  80. $local['loopType'] = 'author';
  81. }
  82. //set the page we're on so that Backbone can load the proper state
  83. if ( is_paged() ) {
  84. $local['page'] = absint( get_query_var( 'paged' ) ) + 1;
  85. }
  86. wp_localize_script( '_s_backbone-loop', 'settings', $local );
  87. }
  88. }
  89. add_action( 'wp_enqueue_scripts', 'dw_scripts' );
  90. function dw_editor() {
  91. //add_editor_style( 'style.css' );
  92. }
  93. add_action( 'init', 'dw_editor' );
  94. ?>