/**
* Bail Hotline functions and definitions
*
* @package Bail Hotline
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 640; /* pixels */
}
if ( ! function_exists( 'bail_hotline_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function bail_hotline_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Bail Hotline, use a find and replace
* to change 'bail-hotline' to the name of your theme in all the template files
*/
load_theme_textdomain( 'bail-hotline', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => 'Primary Header Menu',
'secondary' => 'Secondary Header Menu',
'tertiary' => 'Footer Menu',
'footer_column_1' => 'Footer Column 1',
'footer_column_2' => 'Footer Column 2',
'footer_column_3' => 'Footer Column 3',
'footer_column_4' => 'Footer Column 4',
) );
// Enable support for Post Formats.
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'bail_hotline_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Enable support for HTML5 markup.
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form',
'gallery',
'caption',
) );
}
endif; // bail_hotline_setup
add_action( 'after_setup_theme', 'bail_hotline_setup' );
/* Function used to create widget areas in the Bail Hotline theme */
function create_bailhotline_widget( $name, $id, $description ){
register_sidebar( array(
'name' => __($name),
'id' => $id,
'description' => $description,
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
}
create_bailhotline_widget('Contact Sidebar', 'contact_sidebar', 'Contact sidebar displayed on the contact page');
function bail_hotline_scripts() {
/* Global Styles / Plugin Scripts
=================================================*/
wp_enqueue_style( 'bail-hotline-style', get_stylesheet_uri() );
if(is_page('locations') || is_page('bail-faq')){
wp_enqueue_script('jquery-ui-accordion');
}
wp_enqueue_script('bail-hotline-navigation-script', get_template_directory_uri().'/js/sc-nav.js', array('jquery', 'bail-hotline-js'), false, true);
wp_enqueue_script('bootstrap-script', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js', array('jquery'), false, true);
/* Home Styles / Plugin Scripts
=================================================*/
wp_register_script('jquery-color', get_template_directory_uri().'/js/jquery.color-2.1.2.min.js', array('jquery'), false, true);
if( is_front_page() ){
wp_enqueue_script('jquery-color');
}
/* Office Styles / Plugin Scripts
=================================================*/
/* Contact Styles / Plugin Scripts
=================================================*/
wp_register_script( 'infobox', 'http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.9/src/infobox_packed.js', array('jquery', 'google-places'), false, true);
if( is_page('contact') ){ wp_enqueue_script('infobox'); }
/* GEO Scripts
=================================================*/
// wp_enqueue_script( 'google-places', 'http://maps.googleapis.com/maps/api/js?libraries=places', array('jquery'), false, true);
// wp_enqueue_script('geolocation', get_template_directory_uri().'/js/geolocation.js', array('jquery', 'google-places', 'infobox' ), false, true);
/* Post Page Comments
=================================================*/
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }
wp_enqueue_script('bail-hotline-js', get_template_directory_uri().'/js/bailhotline.js', array('jquery', 'jquery-cookie'), false, true);
/* JQuery
=================================================*/
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', false, '', true);
wp_enqueue_script('jquery');
}
/* JQuery.cookie
================================================*/
wp_register_script('jquery-cookie', get_template_directory_uri().'/js/jquery.cookie.js', array('jquery'), false, true);
wp_enqueue_script('jquery-cookie');
}//bail_hotline_scripts
add_action( 'wp_enqueue_scripts', 'bail_hotline_scripts' );
// Async load
function bhl_async_scripts($url)
{
if ( strpos( $url, '#asyncload') === false )
return $url;
else if ( is_admin() )
return str_replace( '#asyncload', '', $url );
else
return str_replace( '#asyncload', '', $url )."' async='async";
}
add_filter( 'clean_url', 'bhl_async_scripts', 11, 1 );
/**
* Implement the Custom Header feature.
*/
//require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.