functions.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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_deregister_script('jquery');
  22. wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-2.1.1.min.js', array(), false, true);
  23. wp_enqueue_script( 'scripts', get_template_directory_uri() . '/js/scripts.js', 'jquery', '', true );
  24. wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js', 'jquery', '', true );
  25. wp_enqueue_script( 'init', get_template_directory_uri() . '/js/init.js', 'jquery', '', true );
  26. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  27. wp_enqueue_script( 'comment-reply' );
  28. } elseif ( is_home() || is_front_page() || is_archive() || is_search() ) {
  29. global $wp_rewrite;
  30. wp_enqueue_script( '_s_backbone-loop', get_template_directory_uri() . '/js/loop.js', array( 'jquery', 'backbone', 'underscore', 'wp-api' ), '1.0', true );
  31. $queried_object = get_queried_object();
  32. $local = array(
  33. 'loopType' => 'home',
  34. 'queriedObject' => $queried_object,
  35. 'pathInfo' => array(
  36. 'author_permastruct' => $wp_rewrite->get_author_permastruct(),
  37. 'host' => preg_replace( '#^http(s)?://#i', '', untrailingslashit( get_option( 'home' ) ) ),
  38. 'path' => _s_backbone_get_request_path(),
  39. 'use_trailing_slashes' => $wp_rewrite->use_trailing_slashes,
  40. 'parameters' => _s_backbone_get_request_parameters(),
  41. ),
  42. );
  43. if ( is_category() || is_tag() || is_tax() ) {
  44. $local['loopType'] = 'archive';
  45. $local['taxonomy'] = get_taxonomy( $queried_object->taxonomy );
  46. } elseif ( is_search() ) {
  47. $local['loopType'] = 'search';
  48. $local['searchQuery'] = get_search_query();
  49. } elseif ( is_author() ) {
  50. $local['loopType'] = 'author';
  51. }
  52. //set the page we're on so that Backbone can load the proper state
  53. if ( is_paged() ) {
  54. $local['page'] = absint( get_query_var( 'paged' ) ) + 1;
  55. }
  56. wp_localize_script( '_s_backbone-loop', 'settings', $local );
  57. }
  58. }
  59. add_action( 'wp_enqueue_scripts', 'dw_scripts' );
  60. function dw_editor() {
  61. //add_editor_style( 'style.css' );
  62. }
  63. add_action( 'init', 'dw_editor' );
  64. ?>