get_template_directory_uri() .'/images/no-header.jpg',
'height' => 300,
'width' => 980,
'header-text' => false,
'uploads' => true
);
add_theme_support('custom-header', $args);
//title tag
add_theme_support('title-tag');
//custom menu
add_theme_support('menus');
register_nav_menus(array(
'global' => __('Global Navigation', 'aya'),
'footer' => __('Footer Navigation', 'aya')
));
//editor style
add_editor_style('css/editor-style.css');
}
add_action('after_setup_theme', 'aya_theme_setup');
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Read the CSS file
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
if(!function_exists('aya_enqueue_stylesheets')) :
if(!is_admin()) {
function aya_enqueue_stylesheets() {
$dir = get_template_directory_uri();
wp_enqueue_style('fontawesome', $dir .'/css/font-awesome.min.css');
wp_enqueue_style('google_font', '//fonts.googleapis.com/css?family=Roboto:300');
wp_enqueue_style('flickity', $dir .'/css/flickity.css');
wp_enqueue_style('aya_style', get_stylesheet_uri(), array(), '1.0', 'all');
}
}
add_action('wp_enqueue_scripts', 'aya_enqueue_stylesheets');
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Read the JS file
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
if(!function_exists('aya_enqueue_scripts')) :
if(!is_admin()) {
function aya_enqueue_scripts() {
$dir = get_template_directory_uri();
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script('masonry', $dir .'/js/masonry.min.js', array(), NULL, true);
wp_enqueue_script('flickity', $dir .'/js/flickity.min.js', array(), NULL, true);
wp_enqueue_script('aya_js', $dir . '/js/script.js', array('jquery'), NULL, true);
}
}
add_action('wp_enqueue_scripts', 'aya_enqueue_scripts');
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Title tag
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* title tag */
if(!function_exists('aya_document_title')) :
function aya_document_title($title) {
if(is_home() || is_front_page()) {
$title = get_bloginfo('name', 'display');
}
return $title;
}
add_filter('wp_title', 'aya_document_title', 10, 3); //Ver. ~4.3
add_filter('pre_get_document_title', 'aya_document_title', 10, 3); //Ver. 4.4~
endif;
/* separator */
if(!function_exists('aya_title_separator')) :
function aya_title_separator($sep) {
$sep = '|';
return $sep;
}
add_filter('document_title_separator', 'aya_title_separator');
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Custom menu
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* delete id */
if(!function_exists('delete_nav_id')) :
function delete_nav_id($id) {
return $id = array();
}
add_filter('nav_menu_item_id', 'delete_nav_id', 10);
endif;
/* delete class */
if(function_exists('delete_nav_class')) :
function delete_nav_class($class, $item) {
return $class = array();
return $class;
}
add_filter('nav_menu_css_class', 'delete_nav_class', 10, 2);
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Breadcrumb
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
if(!function_exists('aya_breadcrumb')) :
function aya_breadcrumb($args = array()) {
global $post;
$str = '';
$defaults = array(
'class' => 'breadcrumb sp12 t11 p11 text-12',
'home' => __('Home', 'aya'),
'search' => __('Search Results for', 'aya'),
'tag' => __('Tag ', 'aya'),
'author' => __('Posted by', 'aya'),
'notfound' => '404 Not found',
'separator' => ' ',
);
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
if(!is_home() && !is_admin()) {
$str.= '
';
$str.= '
';
$str.= ''. $home .' '. $separator .' ';
$my_taxonomy = get_query_var('taxonomy');
$cpt = get_query_var('post_type');
if($my_taxonomy && is_tax($my_taxonomy)) {
$my_tax = get_queried_object();
$post_types = get_taxonomy($my_taxonomy)->object_type;
$cpt = $post_types[0];
$str.= ''. get_post_type_object($cpt)->label .' '. $separator .' ';
if($my_tax->parent != 0) {
$ancestors = array_reverse(get_ancestors($my_tax->term_id, $my_tax->taxonomy));
foreach($ancestors as $ancestor) {
$str.= ''. get_term($ancestor, $my_tax->taxonomy)->name .' '. $separator .' ';
}
}
$str.= ''. $my_tax->name .' ';
} elseif(is_category()) {
$cat = get_queried_object();
if($cat->parent != 0) {
$ancestors = array_reverse(get_ancestors($cat->cat_ID, 'category'));
foreach($ancestors as $ancestor) {
$str.= ''. get_cat_name($ancestor) .' '. $separator .' ';
}
}
$str.= ''. $cat->name .' ';
} elseif(is_single()) {
$categories = get_the_category($post->ID);
$cat = get_youngest_cat($categories);
if($cat->parent != 0) {
$ancestors = array_reverse(get_ancestors($cat->cat_ID, 'category'));
foreach($ancestors as $ancestor) {
$str.= ''. get_cat_name($ancestor) .' '. $separator .' ';
}
}
$str.= ''. $cat->cat_name .' '. $separator .' ';
$str.= ''. $post->post_title .' ';
} elseif(is_page()) {
if($post->post_parent != 0) {
$ancestors = array_reverse(get_post_ancestors($post->ID));
foreach($ancestors as $ancestor) {
$str.= ''. get_the_title($ancestor) .' '. $separator .' ';
}
}
$str.= ''. $post->post_title .' ';
} elseif(is_date()) {
if(is_day()) {
$str.= ''. get_the_time(__('Y', 'aya')) .' '. $separator .' ';
$str.= ''. get_the_time(__('F', 'aya')) .' '. $separator .' ';
$str.= ''. get_the_time(__('d', 'aya')) .' ';
} elseif(is_month()) {
$str.= ''. get_the_time(__('Y', 'aya')) .' '. $separator .' ';
$str.= ''. get_the_time(__('F', 'aya')) .' ';
} else {
$str.= ''. get_the_time(__('Y', 'aya')) .' ';
}
} elseif(is_search()) {
$str.= ''. $search .' "'. get_search_query() .'" ';
} elseif(is_author()) {
$str .= ''. $author .' : '. get_the_author_meta('display_name', get_query_var('author')) .' ';
} elseif(is_tag()) {
$str.= ''. $tag .' : '. single_tag_title('' , false) .' ';
} elseif(is_attachment()) {
$str.= ''. $post->post_title .' ';
} elseif(is_404()) {
$str.= ''. $notfound .' ';
} else {
$str.= ''. wp_title('', true) .' ';
}
$str.= ' ';
$str.= '
';
}
echo $str;
}
endif;
if(!function_exists('get_youngest_cat')) :
function get_youngest_cat($categories) {
global $post;
if(count($categories) == 1) {
$youngest = $categories[0];
} else {
$count = 0;
foreach($categories as $category) {
$children = get_term_children($category->term_id, 'category');
if($children) {
if ($count < count($children)) {
$count = count($children);
$lot_children = $children;
foreach($lot_children as $child) {
if(in_category($child, $post->ID)){
$youngest = get_category($child);
}
}
}
} else {
$youngest = $category;
}
}
}
return $youngest;
}
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Excerpt setting
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* delete p tag */
remove_filter('the_excerpt', 'wpautop');
/* excerpt_length */
if(!function_exists('aya_excerpt_length')) :
function aya_excerpt_length($length) {
return 120;
}
add_filter('excerpt_length', 'aya_excerpt_length', 999);
endif;
/* excerpt_more */
if(!function_exists('aya_excerpt_more')) :
function aya_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'aya_excerpt_more');
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Pager
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
/* archive */
if(!function_exists('aya_archive_pager')) :
function aya_archive_pager() {
global $wp_query;
$big = 99999999;
$page_format = paginate_links(array(
'current' => max(1, get_query_var('paged')),
'prev_text' => ' ',
'next_text' => ' ',
'total' => $wp_query->max_num_pages,
'type' => 'array'
) );
if(is_array($page_format)) {
$paged = (get_query_var('paged') == 0) ? 1 : get_query_var('paged');
echo '';
}
wp_reset_query();
}
endif;
/* single */
if(!function_exists('prev_post_link_attr')) :
function prev_post_link_attr($output) {
$prev = 'class="prev-arrow"';
return str_replace('
id="comment-">
__('Reply', 'aya'),
'depth' => $depth,
'max_depth' => $args['max_depth']
)));
?>
__('Side widget', 'aya'),
'id' => 'side-widget',
'before_widget' => '',
'before_title' => '',
'after_title' => ' '
));
register_sidebars(1, array(
'name' => __('Free area (Side)', 'aya'),
'id' => 'free-widget-1',
'description' => __('Displayed on above the side widget area. If you select one column layout, it will be shown between the main contents and footer.', 'aya'),
'before_widget' => '',
'after_widget' => '
',
));
register_sidebars(1, array(
'name' => __('Free area (Bottom)', 'aya'),
'id' => 'free-widget-2',
'description' => __('Displayed on the bottom of a single post.', 'aya'),
'before_widget' => '',
'after_widget' => '
',
));
register_sidebars(1, array(
'name' => __('Footer widget', 'aya'),
'id' => 'footer-widget',
'before_widget' => '',
'before_title' => '',
'after_title' => ' '
));
}
add_action('widgets_init', 'aya_widgets_init');
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
editor style
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
if(!function_exists('aya_editor_settings')) :
function aya_editor_settings( $initArray ){
$initArray['body_class'] = 'editor-area';
return $initArray;
}
add_filter('tiny_mce_before_init', 'aya_editor_settings');
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Aya theme customizer
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
if(!function_exists('aya_theme_customizer')) :
function aya_theme_customizer($wp_customize) {
//add panel
$wp_customize->add_panel('aya_panel', array(
'priority' => 10,
'title' => __('Aya Options', 'aya')
));
//add color section
$wp_customize->add_section('aya_color', array(
'panel' => 'aya_panel',
'priority' => 10,
'title' => __('Color', 'aya')
));
//theme color
$wp_customize->add_setting('theme_color', array(
'default' => '#00a3af',
'sanitize_callback' => 'sanitize_hex_color'
));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'theme_color', array(
'label' => __('Theme color', 'aya'),
'section' => 'aya_color',
'setting' => 'theme_color'
)));
//site title and tagline color
$wp_customize->add_setting('text_color', array(
'default' => '#fff',
'sanitize_callback' => 'sanitize_hex_color'
));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'text_color', array(
'label' => __('Site title and tagline color', 'aya'),
'section' => 'aya_color',
'setting' => 'text_color'
)));
//add logo section
$wp_customize->add_section('aya_logo', array(
'panel' => 'aya_panel',
'priority' => 10,
'title' => __('Logo', 'aya')
));
//site logo
$wp_customize->add_setting('site_logo', array(
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'site_logo', array(
'label' => __('Site logo', 'aya'),
'section' => 'aya_logo',
'setting' => 'site_logo'
)));
//tagline
$wp_customize->add_setting('show_tagline', array(
'default' => false,
'sanitize_callback' => 'aya_sanitize_checkbox'
));
$wp_customize->add_control('show_tagline', array(
'label' => __('Do not display tagline', 'aya'),
'section' => 'aya_logo',
'setting' => 'show_tagline',
'type' => 'checkbox'
));
//add layout section
$wp_customize->add_section('aya_layout', array(
'panel' => 'aya_panel',
'priority' => 10,
'title' => __('Layout', 'aya')
));
$wp_customize -> add_setting('column_layout', array(
'default' => 'right',
'sanitize_callback' => 'aya_sanitize_choices',
));
$wp_customize -> add_control('column_layout', array(
'choices' => array(
'right' => __('Right sidebar', 'aya'),
'left' => __('Left sidebar', 'aya'),
'onecolumn' => __('One column', 'aya'),
),
'label' => __('Layout', 'aya'),
'section' => 'aya_layout',
'settings' => 'column_layout',
'type' => 'radio'
));
//related post
$wp_customize->add_setting('show_related', array(
'default' => false,
'sanitize_callback' => 'aya_sanitize_checkbox'
));
$wp_customize->add_control('show_related', array(
'label' => __('Display related posts', 'aya'),
'section' => 'aya_layout',
'setting' => 'show_related',
'type' => 'checkbox'
));
//related post num
$wp_customize->add_setting('related_num', array(
'default' => 10,
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('related_num', array(
'label' => __('Related posts num', 'aya'),
'section' => 'aya_layout',
'setting' => 'related_num'
));
//comment area
$wp_customize->add_setting('show_comment', array(
'default' => false,
'sanitize_callback' => 'aya_sanitize_checkbox'
));
$wp_customize->add_control('show_comment', array(
'label' => __('Do not display comment area', 'aya'),
'section' => 'aya_layout',
'setting' => 'show_comment',
'type' => 'checkbox'
));
$wp_customize->add_setting('show_author', array(
'default' => false,
'sanitize_callback' => 'aya_sanitize_checkbox'
));
$wp_customize->add_control('show_author', array(
'label' => __('Do not display author name', 'aya'),
'section' => 'aya_layout',
'setting' => 'show_author',
'type' => 'checkbox'
));
//footer credits
$wp_customize->add_setting('show_credit', array(
'default' => false,
'sanitize_callback' => 'aya_sanitize_checkbox'
));
$wp_customize->add_control('show_credit', array(
'label' => __('Display footer credits', 'aya'),
'section' => 'aya_layout',
'setting' => 'show_credit',
'type' => 'checkbox'
));
//add custom CSS section
$wp_customize->add_section('aya_css', array(
'panel' => 'aya_panel',
'priority' => 10,
'title' => __('Custom CSS', 'aya')
));
$wp_customize->add_setting('custom_css', array(
'sanitize_js_callback' => 'esc_textarea',
'type' => 'option'
));
if(class_exists('Customize_Textarea_Control')) {
$wp_customize->add_control(new Customize_Textarea_Control($wp_customize, 'custom_css', array(
'label' => __('Custom CSS', 'aya'),
'section' => 'aya_css',
'settings' => 'custom_css',
'type' => 'textarea'
)));
}
}
add_action('customize_register', 'aya_theme_customizer');
endif;
/* change theme color */
if(!function_exists('aya_theme_color')) :
function aya_theme_color() {
$theme_color = get_theme_mod('theme_color', '#00a3af');
$text_color = get_theme_mod('text_color', '#fff');
?>
label); ?>
get_control($setting->id);
if(array_key_exists($input, $control->choices)) {
return $input;
} else {
return $setting->default;
}
}
endif;
//check
if(!function_exists('aya_sanitize_checkbox')) :
function aya_sanitize_checkbox($input) {
if($input == true) {
return true;
} else {
return false;
}
}
endif;
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Aya theme descriotion
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
function aya_theme_description() {
$aya_theme_description = __('Aya is simple blog theme. It is designed a mobile-first and using a responsive layout, and automatically respond to smartphone, tablet, laptop or desktop. Aya has various options in WordPress Customizer to change the look of the theme - theme base color, header image, page layout (right sidebar, left sidebar, one column) etc. Translation is compatible with Japanese.', 'aya');
return $aya_theme_description;
}
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Footer credits
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
if(!function_exists('aya_footer_credits')) :
function aya_footer_credits() {
$aya_credit_url = 'http://sunbelier.com/';
$wp_credit_url = 'http://wordpress.org/';
echo ' Theme by Sunbelier . Powered by WordPress .';
}
endif;