functions.php 3.2 KB

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