<?php
remove_action('wp_head', 'wp_generator');		//header要素<meta name="generator" を削除
remove_action('wp_head', 'rel_canonical');		//header要素<link rel='canonical' を削除
remove_action('wp_head', 'wp_shortlink_wp_head');		//header要素<link rel='shortlink' を削除
remove_action('wp_head', 'wlwmanifest_link');		//header要素<link rel="wlwmanifest" を削除
remove_action('wp_head', 'rsd_link');		//header要素<link rel="EditURI" を削除

/* 抜粋する文字数を変更する */
function new_excerpt_mblength($length) {
     return 150;
}  
add_filter('excerpt_mblength', 'new_excerpt_mblength');

/* 抜粋の文末に表示される文字列を変更する */
function new_excerpt_more($more) {
    return '・・・';
}  
add_filter('excerpt_more', 'new_excerpt_more');


//　アイキャッチ画像を利用できるようにします。
add_theme_support('post-thumbnails');

//　アイキャッチ画像サイズ設定
//set_post_thumbnail_size(90 ,90 ,true);

//　サブページヘッダー用画像サイズ設定
//add_image_size('category_image', 190, 135, true);

//ホームページタグショートコード
function home_func() {
	return home_url();
}
add_shortcode('my_home_url','home_func');

//　パーマリンクから『category/』を消す
/*function remcat_function($link) {
	return str_replace("/category/", "/", $link);
}
add_filter('user_trailingslashit', 'remcat_function');
function remcat_flush_rules() {
	global $wp_rewrite;
	$wp_rewrite->flush_rules();
}
add_action('init', 'remcat_flush_rules');
function remcat_rewrite($wp_rewrite) {
	$new_rules = array('(.+)/page/(.+)/?' => 'index.php?category_name='.$wp_rewrite->preg_index(1).'&paged='.$wp_rewrite->preg_index(2));
	$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
add_filter('generate_rewrite_rules', 'remcat_rewrite');
*/

if ( ! function_exists( 'twentyfourteen_paging_nav' ) ) :
/**
 * ページナビ（カテゴリページでの1ページ当たりの表示数を超えた場合の遷移関数）
 * Display navigation to next/previous set of posts when applicable.
 *
 * @since Twenty Fourteen 1.0
 *
 * @global WP_Query   $wp_query   WordPress Query object.
 * @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
 */
function twentyfourteen_paging_nav() {
	global $wp_query, $wp_rewrite;

	// Don't print empty markup if there's only one page.
	if ( $wp_query->max_num_pages < 2 ) {
		return;
	}

	$paged        = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
	$pagenum_link = html_entity_decode( get_pagenum_link() );
	$query_args   = array();
	$url_parts    = explode( '?', $pagenum_link );

	if ( isset( $url_parts[1] ) ) {
		wp_parse_str( $url_parts[1], $query_args );
	}

	$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
	$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';

	$format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
	$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';

	// Set up paginated links.
	$links = paginate_links( array(
		'base'     => $pagenum_link,
		'format'   => $format,
		'total'    => $wp_query->max_num_pages,
		'current'  => $paged,
		'mid_size' => 2,
		'add_args' => array_map( 'urlencode', $query_args ),
		'prev_text' => __( '&larr; 前へ', 'twentyfourteen' ),
		'next_text' => __( '次へ &rarr;', 'twentyfourteen' ),
	) );

	if ( $links ) :

	?>
	<nav class="navigation paging-navigation" role="navigation">
		<div class="pagination loop-pagination clearfix">
			<?php echo $links; ?>
		</div><!-- .pagination -->
	</nav><!-- .navigation -->
	<?php
	endif;
}
endif;

#1ページの表示の順番を古い順に表示する。
function my_pre_get_posts($query) {
    if (is_category('schedule')) {
        $query->set('order', 'ASC');
    }
}
add_action('pre_get_posts', 'my_pre_get_posts');


/* 投稿者アーカイブを無効化してWordPressのユーザ名を隠す */
add_filter( 'author_rewrite_rules', '__return_empty_array' );
function disable_author_archive() {
if( $_GET['author'] || preg_match('#/author/.+#', $_SERVER['REQUEST_URI']) ){
wp_redirect( home_url( '/404.php' ) );
exit;
}
}
add_action('init', 'disable_author_archive');


?>