'f2f2f2',
'text' => '727272',
'link' => '7292c2',
'border' => 'f0f0f0',
'url' => '7292c2',
);
}
/**
* Tell WordPress to run nishita_setup() when the 'after_setup_theme' hook is run.
*/
add_action( 'after_setup_theme', 'nishita_setup' );
if ( ! function_exists( 'nishita_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 post thumbnails.
*
* To override nishita_setup() in a child theme, add your own nishita_setup to your child theme's
* functions.php file.
*
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_theme_support() To add support for post thumbnails, automatic feed links, and Post Formats.
* @uses register_nav_menus() To add support for navigation menus.
* @uses add_theme_support( 'custom-background' ) To add support for a custom background.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
*/
function nishita_setup() {
// Load up our theme options page and related code.
require( dirname( __FILE__ ) . '/inc/theme-options.php' );
// Automatic Feed Links
add_theme_support( 'automatic-feed-links' );
// I18n
load_theme_textdomain( 'nishita', get_template_directory() . '/languages' );
// Navigation Menu
register_nav_menu( 'primary', __( 'Primary Menu', 'nishita' ) );
// Custom Background
add_theme_support( 'custom-background' );
// Post Thumbnails
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 128, 128 ); // 128 pixels wide by 128 pixels tall, soft proportional crop mode
add_theme_support( 'print-style' );
}
endif; // nishita_setup
/**
* Enqueue scripts and styles
*/
function nishita_scripts() {
wp_enqueue_style( 'nishita', get_stylesheet_uri() );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'nishita_scripts' );
/**
* Register our sidebars and widgetized areas.
*/
add_action( 'widgets_init', 'nishita_register_sidebars' );
if ( ! function_exists( 'nishita_register_sidebars' ) ) :
function nishita_register_sidebars() {
/*
Add theme support for widgetized sidebars.
*/
register_sidebar(array(
'name' => __( 'Primary Sidebar', 'nishita' ),
'id' => 'primary-sidebar',
'description' => __( 'Widgets in this sidebar will be shown adjacent to all site content (with the exception of individual image attachment pages).', 'nishita' ),
'before_title' => '
'
));
register_sidebar(array(
'name' => __( 'Footer Area One', 'nishita' ),
'id' => 'footer-area-one',
'description' => __( 'Widgets in this area will be shown below all site content and adjacent to the "Footer Area Two" area.', 'nishita' ),
'before_title' => ''
));
register_sidebar(array(
'name' => __( 'Footer Area Two', 'nishita' ),
'id' => 'footer-area-two',
'description' => __( 'Widgets in this area will be shown below all site content and adjacent to the "Footer Area One" and "Footer Area Three" areas.', 'nishita' ),
'before_title' => ''
));
register_sidebar(array(
'name' => __( 'Footer Area Three', 'nishita' ),
'id' => 'footer-area-three',
'description' => __( 'Widgets in this area will be shown below all site content and adjacent to the "Footer Area Two" area.', 'nishita' ),
'before_title' => ''
));
}
endif; // nishita_register_sidebars
/**
* Modify the font sizes of WordPress' tag cloud
*/
if ( ! function_exists( 'nishita_widget_tag_cloud_args' ) ) :
function nishita_widget_tag_cloud_args( $args ) {
$args['smallest'] = 12;
$args['largest']= 18;
$args['unit']= 'px';
return $args;
}
add_filter( 'widget_tag_cloud_args', 'nishita_widget_tag_cloud_args' );
endif; // nishita_widget_tag_cloud_args
if ( ! function_exists( 'nishita_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own nishita_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
*/
function nishita_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
', '' ); ?>
id="li-comment-">
get_the_ID(),
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC',
'numberposts' => 999,
'fields' => 'ids',
) );
if ( $images )
echo wp_get_attachment_image( array_shift( $images ), array( 128,128 ) );
}
}
endif;
if ( ! function_exists( 'nishita_the_attached_image' ) ) :
/**
* Prints the attached image with a link to the next attached image.
*/
function nishita_the_attached_image() {
$post = get_post();
// If post parent is password protected, show the form and bail.
if ( post_password_required( $post->post_parent ) ) {
echo get_the_password_form( $post->post_parent );
return;
}
$attachment_size = apply_filters( 'nishita_attachment_size', 1024 );
$next_attachment_url = wp_get_attachment_url();
/**
* Grab the IDs of all the image attachments in a gallery so we can get the URL
* of the next adjacent image in a gallery, or the first image (if we're
* looking at the last image in a gallery), or, in a gallery of one, just the
* link to that image file.
*/
$attachments = array_values( get_children( array(
'post_parent' => $post->post_parent,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID'
) ) );
// If there is more than 1 attachment in a gallery...
if ( count( $attachments ) > 1 ) {
foreach ( $attachments as $k => $attachment ) {
if ( $attachment->ID == $post->ID )
break;
}
$k++;
// get the URL of the next image attachment...
if ( isset( $attachments[ $k ] ) )
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
// or get the URL of the first image attachment.
else
$next_attachment_url = get_attachment_link( $attachments[0]->ID );
}
printf( '%3$s',
esc_url( $next_attachment_url ),
the_title_attribute( array( 'echo' => false ) ),
wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) )
);
}
endif;
/**
* Ensure that all archive page show at least 10 posts.
*
* Hooked onto the 'pre_get_posts' action, this changes the parameters
* of the query before it gets any posts.
*
* @param WP_Query $query
* @return WP_Query Possibly modified WP_query
*/
function nishita_archive_posts( $query = false ) {
if ( ! is_archive() || ! is_a( $query, 'WP_Query' ) || ! $query->is_main_query() )
return;
$postsppage = get_option( 'posts_per_page' );
if ( 10 > $postsppage )
$query->set( 'posts_per_page', 10 );
}
add_action( 'pre_get_posts', 'nishita_archive_posts' );
/**
* Filters wp_title to print a neat tag based on what is being viewed.
*
* @since Nishita 1.2.2
*/
function nishita_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', 'nishita' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'nishita_wp_title', 10, 2 );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';