'ffffff',
'text' => '333333',
'link' => '265e15',
'border' => 'ededed',
'url' => '996633',
);
add_theme_support( 'automatic-feed-links' );
add_custom_background();
add_theme_support( 'print-style' );
register_sidebar(array(
'before_widget' => '
',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
));
// Register Nav Menu
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'mistylook' ),
) );
/**
* Enqueue scripts and styles
*/
function mistylook_scripts() {
wp_enqueue_style( 'mistylook', get_stylesheet_uri() );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'mistylook_scripts' );
// Optionally add listed search to nav menus
function mistylook_nav_menu_search( $items, $args ) {
$mistylook_options = get_option('mistylook_theme_options'); // hide-header-search
if (
isset( $mistylook_options['hide-header-search'] )
&& ! $mistylook_options['hide-header-search']
&& $args->theme_location == 'primary'
) {
$items .= '';
}
return $items;
}
add_filter( 'wp_nav_menu_items', 'mistylook_nav_menu_search', 1, 2 );
// A custom fallback for the MistyLook menus
function mistylook_menu_fallback() { ?>
'linkcat widget sidebox'
));
}
define('HEADER_TEXTCOLOR', '265E15');
define('HEADER_IMAGE', '%s/img/misty.jpg'); // %s is theme dir uri
define('HEADER_IMAGE_WIDTH', 760);
define('HEADER_IMAGE_HEIGHT', 190);
if ( function_exists( 'add_custom_image_header' ) ) {
add_custom_image_header( 'mistylook_header_style', 'mistylook_admin_header_style', 'mistylook_admin_header_image' );
}
function mistylook_header_style() {
$header_image = get_header_image();
if ( HEADER_TEXTCOLOR == get_header_textcolor() && empty( $header_image ) )
return;
?>
>
id="comment-">
%3$s',
get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
get_the_author()
);
}
// We loves us a Theme Option or two. =]
add_action( 'admin_init', 'mistylook_theme_options_init' );
add_action( 'admin_menu', 'mistylook_theme_options_add_page' );
// Init theme options to white list our options
function mistylook_theme_options_init() {
register_setting( 'mistylook_theme', 'mistylook_theme_options', 'mistylook_theme_options_validate' );
}
// Load up the menu page
function mistylook_theme_options_add_page() {
add_theme_page( __( 'Theme Options' ), __( 'Theme Options' ), 'edit_theme_options', 'theme_options', 'mistylook_theme_options_do_page' );
}
// Create the options page
function mistylook_theme_options_do_page() {
?>
" . get_current_theme() . __( ' Theme Options' ) . ""; ?>
tag based on what is being viewed.
*
* @since Mistylook 3.1
*/
function mistylook_wp_title( $title, $sep ) {
global $page, $paged;
if ( is_feed() )
return $title;
// Add the blog name
$title .= get_bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title .= " $sep $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
$title .= " $sep " . sprintf( __( 'Page %s', 'mistylook' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'mistylook_wp_title', 10, 2 );
/**
* WP.com: Show a nice admin message noting that the current theme has been
* trumped by a newer one.
*/
function mistylook_add_notice() {
$current_theme = wp_get_theme()->Name;
if ( ! get_user_meta( get_current_user_id(), "$current_theme-theme-update", true ) ) {
add_settings_error(
'theme-update',
'theme-update',
sprintf(
__( 'Howdy! Your current theme, %1$s, has seen an update in the form of a brand new theme, %2$s. For more information, check out our blog post introducing %2$s to the world. %5$s' ),
$current_theme, // Old theme
'Misty Lake', // New theme
admin_url( 'themes.php?s=misty-lake' ), // Link to new theme
esc_url( 'http://en.blog.wordpress.com/2012/12/20/new-themes-book-lite-and-misty-lake/' ), // Link to announcement post
sprintf( '×', __( 'Dismiss' ) ) // Dismiss
),
'updated'
);
remove_action( 'admin_notices', 'show_tip' );
if ( ! has_filter( 'admin_notices', 'settings_errors' ) )
add_action( 'admin_notices', 'settings_errors' );
wp_enqueue_script( 'dismiss-theme-update', get_template_directory_uri() . '/js/dismiss-theme-update.js', array( 'jquery' ), 20130225 );
wp_localize_script( 'dismiss-theme-update', 'dismissThemeUpdate', array(
'theme' => $current_theme,
'nonce' => wp_create_nonce( "$current_theme-theme-update" ),
) );
}
}
add_action( 'admin_init', 'mistylook_add_notice' );
/**
* Updates user setting when theme update notice was dismissed.
*/
function mistylook_dismiss_theme_update() {
$current_theme = wp_get_theme()->Name;
check_ajax_referer( "$current_theme-theme-update", 'nonce' );
if ( $_REQUEST['theme'] == $current_theme ) {
update_user_meta( get_current_user_id(), "$current_theme-theme-update", true );
wp_die( 1 );
}
}
add_action( 'wp_ajax_dismiss_theme_update', 'mistylook_dismiss_theme_update' );