$backgroundcolor,
'default-image' => get_template_directory_uri() . '/images/background-' . $colorscheme . '.png',
);
$args = apply_filters( 'babylog_custom_background_args', $args );
add_theme_support( 'custom-background', $args );
/**
* Enable support for Post Thumbnails
*/
add_theme_support( 'post-thumbnails' );
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'babylog' ),
) );
/**
* Theme Colors
*/
$options = babylog_get_theme_options();
$colorscheme = $options['color_scheme'];
if ( isset( $colorscheme ) && ! empty( $colorscheme ) ) {
if ( 'green' == $colorscheme )
$backgroundcolor = 'c2e2bf';
else if ( 'blue' == $colorscheme )
$backgroundcolor = '86afbf';
else if ( 'pink' == $colorscheme )
$backgroundcolor = 'e29393';
else if ( 'purple' == $colorscheme )
$backgroundcolor = 'bfa1c6';
}
else {
$backgroundcolor = 'bfa1c6';
}
if ( ! isset( $themecolors ) ) {
$themecolors = array(
'bg' => $backgroundcolor,
'text' => '666666',
'link' => '9b6745',
'border' => 'CCCCCC',
'url' => '9b6745',
);
}
}
endif; // babylog_setup
add_action( 'after_setup_theme', 'babylog_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since Babylog 1.0
*/
function babylog_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'babylog' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'babylog_widgets_init' );
/*
* Create one function to register Google web fonts
*/
function babylog_fonts() {
wp_register_style( 'babylog-vidaloka', "https://fonts.googleapis.com/css?family=Vidaloka" );
}
add_action( 'init', 'babylog_fonts' );
/*
* De-queue Google fonts if custom fonts are being used instead
*/
function babylog_dequeue_fonts() {
if ( class_exists( 'TypekitData' ) && class_exists( 'CustomDesign' ) ) {
if ( CustomDesign::is_upgrade_active() ) {
$customfonts = TypekitData::get( 'families' );
if ( ! $customfonts )
return;
$site_title = $customfonts['site-title'];
$headings = $customfonts['headings'];
$body_text = $customfonts['body-text'];
if ( $site_title['id'] && $headings['id'] && $body_text['id'] ) {
wp_dequeue_style( 'babylog-vidaloka' );
}
}
}
}
add_action( 'wp_enqueue_scripts', 'babylog_dequeue_fonts' );
/**
* Enqueue scripts and styles
*/
function babylog_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_style( 'babylog-vidaloka' );
wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
}
add_action( 'wp_enqueue_scripts', 'babylog_scripts' );
/**
* Output the custom baby graphic based on theme options
*/
function babylog_baby() {
$options = babylog_get_theme_options();
$haircolor = $options['hair_color'];
$themecolor = $options['color_scheme'];
$skincolor = $options['skin_tone'];
$showbaby = $options['show_baby'];
if ( isset( $showbaby ) && 'no' == $showbaby )
return;
if ( isset( $haircolor ) && ! empty( $haircolor ) )
$haircolor = esc_attr( $haircolor );
else
$haircolor = 'brown';
if ( isset( $skincolor ) && ! empty( $skincolor ) )
$skincolor = esc_attr( $skincolor );
else
$skincolor = 'medium';
if ( isset( $themecolor ) && ! empty( $themecolor ) )
$themecolor = esc_attr( $themecolor );
else
$themecolor = 'purple';
$babyurl = esc_attr( get_template_directory_uri() . '/images/' . $themecolor . '-' . $skincolor . '-' . $haircolor . '.png' );
printf( '
' );
}
/**
* Enqueue custom header fonts
*/
function babylog_custom_header_fonts( $hook_suffix ) {
if ( 'appearance_page_custom-header' != $hook_suffix )
return;
wp_enqueue_style( 'babylog-vidaloka' );
}
add_action( 'admin_enqueue_scripts', 'babylog_custom_header_fonts' );
/**
* Enqueue theme options script
*/
function babylog_theme_options_scripts( $hook_suffix ) {
if ( 'appearance_page_theme_options' != $hook_suffix )
return;
$babylogdirectory = array( 'directory' => get_template_directory_uri() . '/images/' );
wp_enqueue_script( 'babylog-admin-controls', get_template_directory_uri() . '/inc/theme-options/theme-options.js', array( 'jquery' ), '20120918' );
wp_localize_script( 'babylog-admin-controls', 'template', $babylogdirectory );
}
add_action( 'admin_enqueue_scripts', 'babylog_theme_options_scripts' );
/**
* Implement the Custom Header feature
*/
require( get_template_directory() . '/inc/custom-header.php' );
/*
* Load Jetpack compatibility file.
*/
require( get_template_directory() . '/inc/jetpack.php' );