123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <?php
- if ( ! function_exists( 'dw_setup' ) ):
- function dw_setup() {
- require( get_template_directory() . '/inc/utils.php' );
- require( get_template_directory() . '/inc/template.php' );
- require( get_template_directory() . '/inc/tweaks.php' );
- if ( ! isset( $content_width ) ) $content_width = 1310;
- add_theme_support( 'title-tag' );
- add_theme_support( 'wp-block-styles' );
- add_theme_support( 'automatic-feed-links' );
- add_theme_support( 'responsive-embeds' );
- add_theme_support( 'menus' );
- add_theme_support( 'post-thumbnails' );
- add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );
- add_theme_support( 'post-formats', array( 'aside', 'gallery', 'image', 'video', 'audio', 'quote', 'link', 'status', 'chat' ) );
- set_post_thumbnail_size( 150, 150, true );
- add_image_size( 'post-large', 770, 577, true );
- add_image_size( 'studio', 400, 300, true );
- add_filter( 'big_image_size_threshold', '__return_false' );
- add_theme_support( 'align-wide' );
- remove_action( 'init', 'wp_sitemaps_get_server' );
- }
- endif;
- add_action( 'after_setup_theme', 'dw_setup' );
- if ( ! function_exists( 'dw_plugs' ) ):
- function dw_plugs() {
- require( get_template_directory() . '/inc/smtp.php');
- //echo wp_mail( 'david@davidawindham.com', 'WP Mail Test', 'Mail is working' );
- if (!class_exists('dw_crumbs')) {
- //include_once(TEMPLATEPATH.'/inc/crumbs.php');
- }
- }
- endif;
- add_action( 'after_setup_theme', 'dw_plugs' );
- function dw_editor() {
- wp_enqueue_style( 'dw-gutenberg', get_theme_file_uri( '/css/editor.css' ), false, '1.0', 'all' );
- }
- add_action( 'enqueue_block_editor_assets', 'dw_editor' );
- function dw_remove_block_library_css(){
- wp_dequeue_style( 'wp-block-library' );
- }
- //add_action( 'wp_enqueue_scripts', 'dw_remove_block_library_css' );
- add_action( 'wp_enqueue_scripts', 'dw_scripts' );
- function dw_scripts() {
- global $post;
- wp_enqueue_style( 'style-min', get_template_directory_uri() . '/v4-style.min.css');
- wp_deregister_script('jquery');
- if ( is_page('about') ) {
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_script( 'init', get_template_directory_uri() . '/js/about.js', '', '', true );
- }
- elseif ( is_page('studio') ) {
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_script( 'init', get_template_directory_uri() . '/js/studio.js', '', '', true );
- }
- elseif ( is_page('music') ) {
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_script( 'last-fm', get_template_directory_uri() . '/js/music.js', '', '', true );
- }
- elseif ( is_page('art') ) {
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_script( 'art', get_template_directory_uri() . '/js/art.js', '', '', true );
- }
- elseif ( is_page('contact') ) {
- require( get_template_directory() . '/inc/form.php' );
- //gravity_form_enqueue_scripts(1, false);
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_style( 'gforms', get_template_directory_uri() . '/css/form.css');
- wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-3.1.0.min.js', array(), false, true);
- wp_enqueue_script('stripe', 'https://js.stripe.com/v2/', array(), '3', true);
- wp_enqueue_script( 'form', get_template_directory_uri() . '/js/contact.js', '', '', true );
- }
- elseif ( is_page('guests') ) {
- require( get_template_directory() . '/inc/form.php' );
- //gravity_form_enqueue_scripts(1, false);
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_style( 'gforms', get_template_directory_uri() . '/css/form.css');
- wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-3.1.0.min.js', array(), false, true);
- wp_enqueue_script( 'form', get_template_directory_uri() . '/js/contact.js', '', '', true );
- }
- elseif ( is_page('contract') ) {
- require( get_template_directory() . '/inc/form.php' );
- //gravity_form_enqueue_scripts(1, false);
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_style( 'gforms', get_template_directory_uri() . '/css/form.css');
- wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-3.1.0.min.js', array(), false, true);
- wp_enqueue_script( 'form', get_template_directory_uri() . '/js/contact.js', '', '', true );
- }
- elseif ( is_page('pay') ) {
- require( get_template_directory() . '/inc/form.php' );
- //gravity_form_enqueue_scripts(1, false);
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_style( 'gforms', get_template_directory_uri() . '/css/form.css');
- wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-3.1.0.min.js', array(), false, true);
- }
- elseif ( is_page('analytics') ) {
- require( get_template_directory() . '/inc/analytics.php' );
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_script( 'dashboardjs', get_template_directory_uri() . '/js/analytics.js', '', '', true );
- }
- elseif ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_script( 'single', get_template_directory_uri() . '/js/single.js', '', '', true );
- wp_enqueue_script( 'comment-reply' );
- }
- elseif ( is_page('desk') || is_archive() || is_search() ) {
- global $wp_rewrite;
- wp_enqueue_script( 'jquery', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_script( 'desk', get_template_directory_uri() . '/js/desk.js', '', '', true );
- wp_enqueue_script( '_s_backbone-loop', get_template_directory_uri() . '/js/loop.js', array( 'jquery', 'backbone', 'underscore', 'wp-api' ), '1.0', true );
- $queried_object = get_queried_object();
- $local = array(
- 'loopType' => 'home',
- 'queriedObject' => $queried_object,
- 'pathInfo' => array(
- 'author_permastruct' => $wp_rewrite->get_author_permastruct(),
- 'host' => preg_replace( '#^http(s)?://#i', '', untrailingslashit( home_url() ) ),
- 'path' => _s_backbone_get_request_path(),
- 'use_trailing_slashes' => $wp_rewrite->use_trailing_slashes,
- 'parameters' => _s_backbone_get_request_parameters(),
- ),
- );
- if ( is_category() || is_tag() || is_tax() ) {
- $local['loopType'] = 'archive';
- $local['taxonomy'] = get_taxonomy( $queried_object->taxonomy );
- } elseif ( is_search() ) {
- $local['loopType'] = 'search';
- $local['searchQuery'] = get_search_query();
- } elseif ( is_author() ) {
- $local['loopType'] = 'author';
- }
- if ( is_paged() ) {
- $local['page'] = absint( get_query_var( 'paged' ) ) + 1;
- }
- wp_localize_script( '_s_backbone-loop', 'settings', $local );
- }
- else {
- //wp_deregister_script('mediaelement');
- wp_enqueue_script( 'scriptmin', get_template_directory_uri() . '/js/v4-script.min.js', '', '', true );
- wp_enqueue_script( 'single', get_template_directory_uri() . '/js/single.js', '', '', true );
- wp_enqueue_script( 'mediaelement-me', get_template_directory_uri() .'/js/mediaelement-and-player.min.js', '', '', true);
- wp_enqueue_script( 'mediaelement-wp', get_template_directory_uri() .'/js/wp-mediaelement.min.js', '', '', true);
- }
- }
- add_action('wp_footer', 'dw_analytics', 22);
- function dw_analytics() { ?>
- <script>
- var _paq = window._paq = window._paq || [];
- /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
- _paq.push(['trackPageView']);
- _paq.push(['enableLinkTracking']);
- (function() {
- var u="https://davidawindham.com/wik/";
- _paq.push(['setTrackerUrl', u+'matomo.php']);
- _paq.push(['setSiteId', '1']);
- var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
- g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
- })();
- </script>
- <noscript><p><img src="https://davidawindham.com/wik/matomo.php?idsite=1&rec=1" style="border:0;" alt="" /></p></noscript>
- <?php }
- ?>
|