の中に置換 /*-------------------------------------------*/ /* カテゴリー件数をの中に置換 /*-------------------------------------------*/ /* TinyMCEでiframeタグ(GoogleMapなど)の自動消去禁止指定 /*-------------------------------------------*/ /* 画像挿入時のwidthとheight指定削除 /* (スマホ表示の際に画像サイズ自動調整がうまくいかない為) /*-------------------------------------------*/ /* Comment /*-------------------------------------------*/ /* Archive page link ( don't erase ) /*-------------------------------------------*/ /* ページング /*-------------------------------------------*/ /* Comment out short code /*-------------------------------------------*/ // ▼管理バー非表示 // ▼メニューに「すべての設定」項目を加える add_theme_support( 'automatic-feed-links' ); /*-------------------------------------------*/ /* Set content width /* (Auto set up to media max with.) /*-------------------------------------------*/ if ( ! isset( $content_width ) ) $content_width = 640; /*-------------------------------------------*/ /* カスタムメニュー /*-------------------------------------------*/ register_nav_menus( array( 'Header' => 'Header Navigation', ) ); register_nav_menus( array( 'FooterNavi' => 'Footer Navigation', ) ); register_nav_menus( array( 'FooterSiteMap' => 'Footer SiteMap', ) ); /*-------------------------------------------*/ /* ウィジェット /*-------------------------------------------*/ function biz_vektor_widgets_init() { register_sidebar( array( 'name' => __( 'サイドバー(トップのみ)', 'biz_vektor' ), 'id' => 'top-side-widget-area', 'description' => __( 'トップページにのみ表示されるサイドバーウィジェットです。ドラッグ&ドロップで必要なものだけ入れてください。バナーやブログパーツなどは、『テキスト』ウィジェットを使用して、ソースコードを張り付けられます。サイドバーウィジェット(共通)の上に表示されます。', 'biz_vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // Area 1, located at the top of the sidebar. register_sidebar( array( 'name' => __( 'サイドバー(共通・上)', 'biz_vektor' ), 'id' => 'primary-widget-area', 'description' => __( 'サイドバーに表示するウィジェットです。facebook,twitterバナーの上に表示されます。', 'biz_vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'サイドバー(共通・下)', 'biz_vektor' ), 'id' => 'secondary-widget-area', 'description' => __( 'サイドバーに表示するウィジェットです。facebook,twitterバナーの下に表示されます。', 'biz_vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'サイドバー(投稿・問い合わせバナー上)', 'biz_vektor' ), 'id' => 'blog-first-widget-area', 'description' => __( '投稿コンテンツのページにのみ表示されるウィジェットです。問い合わせバナーの上に表示されます。', 'biz_vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'biz_vektor_widgets_init' ); /*-------------------------------------------*/ /* カスタムヘッダー /*-------------------------------------------*/ // カスタムヘッダーのテキスト機能を利用する場合 define( 'HEADER_TEXTCOLOR', '' ); // カスタムヘッダーのテキスト機能をオフにする define( 'NO_HEADER_TEXT', true ); define('HEADER_IMAGE', '%s/images/headers/bussines_desk_02.jpg'); define('HEADER_IMAGE_WIDTH', 950); define('HEADER_IMAGE_HEIGHT', 250); register_default_headers( array( 'bussines_desk_02' => array( 'url' => '%s/images/headers/bussines_desk_02.jpg', 'thumbnail_url' => '%s/images/headers/bussines_desk_02-thumbnail.jpg', 'description' => 'Bussines desk01' ), 'bussines_desk_01' => array( 'url' => '%s/images/headers/bussines_desk_01.jpg', 'thumbnail_url' => '%s/images/headers/bussines_desk_01-thumbnail.jpg', 'description' => 'Bussines desk01' ), 'autumn-leaves' => array( 'url' => '%s/images/headers/autumn-leaves.jpg', 'thumbnail_url' => '%s/images/headers/autumn-leaves-thumbnail.jpg', 'description' => 'autumn-leaves' ), 'johnny_01' => array( 'url' => '%s/images/headers/johnny_01.jpg', 'thumbnail_url' => '%s/images/headers/johnny_01-thumbnail.jpg', 'description' => 'Johnny' ), ) ); add_custom_image_header('admin_header_style', ''); if ( ! function_exists( 'admin_header_style' ) ) ://wp_headでにCSSを追加。無いとエラーが出るので削除不可 function admin_header_style() { } endif; /*-------------------------------------------*/ /* カスタム背景 /*-------------------------------------------*/ add_custom_background(); // add_theme_support( 'custom_background' ); /*-------------------------------------------*/ /* テーマオプションを読み込む /*-------------------------------------------*/ require( dirname( __FILE__ ) . '/inc/theme-options.php' ); /*-------------------------------------------*/ /* Calmly用セッティングを読み込む /*-------------------------------------------*/ require( dirname( __FILE__ ) . '/bizvektor_themes/002/002_custom.php' ); /*-------------------------------------------*/ /* テーマカスタマイザーセッティング /*-------------------------------------------*/ require( dirname( __FILE__ ) . '/inc/theme-customizer.php' ); /*-------------------------------------------*/ /* 管理画面_スタイルを追加 /*-------------------------------------------*/ function bizVektor_admin_css(){ // echo ''; $adminCssPath = get_template_directory_uri().'/style_BizVektor_admin.css'; wp_enqueue_style( 'theme', $adminCssPath , false, '2012-06-24'); } add_action('admin_head', 'bizVektor_admin_css', 11); /*-------------------------------------------*/ /* 管理画面_投稿ステータスをbodyのclassに追加 /*-------------------------------------------*/ function bizVektor_postStatus(){ $classes = get_post_status() // 投稿の状態を取得; ?> '; echo ''; echo '

このページで個別に設定するキーワードを , 区切りで入力して下さい(任意)
'; echo '※サイト全体に共通して設定するキーワードはテーマオプションから設定出来ます。

'; } function save_custom_field_metaKeyword($post_id){ if(!wp_verify_nonce($_POST['noncename_custom_field_metaKeyword'], plugin_basename(__FILE__))){ return $post_id; } if('page' == $_POST['post_type']){ if(!current_user_can('edit_page', $post_id)) return $post_id; }else{ if(!current_user_can('edit_post', $post_id)) return $post_id; } $data = $_POST['metaKeyword']; if(get_post_meta($post_id, 'metaKeyword') == ""){ add_post_meta($post_id, 'metaKeyword', $data, true); }elseif($data != get_post_meta($post_id, 'metaKeyword', true)){ update_post_meta($post_id, 'metaKeyword', $data); }elseif($data == ""){ delete_post_meta($post_id, 'metaKeyword', get_post_meta($post_id, 'metaKeyword', true)); } } /*-------------------------------------------*/ /* 管理画面_固定ページのカスタマイズ /*-------------------------------------------*/ add_post_type_support( 'page', 'excerpt' ); // 抜粋欄を追加 function remove_default_page_screen_metaboxes() { // remove_meta_box( 'postcustom','page','normal' ); // カスタムフィールド // remove_meta_box( 'postexcerpt','page','normal' ); // 抜粋 remove_meta_box( 'commentstatusdiv','page','normal' ); // ディスカッション remove_meta_box( 'commentsdiv','page','normal' ); // コメント remove_meta_box( 'trackbacksdiv','page','normal' ); // トラックバック // remove_meta_box( 'authordiv','page','normal' ); // 作成者 // remove_meta_box( 'slugdiv','page','normal' ); // スラッグ // remove_meta_box( 'revisionsdiv','page','normal' ); // リビジョン } add_action('admin_menu','remove_default_page_screen_metaboxes'); /*-------------------------------------------*/ /* 管理画面_投稿のカスタマイズ /*-------------------------------------------*/ function remove_default_post_screen_metaboxes() { // remove_meta_box( 'postcustom','post','normal' ); // カスタムフィールド // remove_meta_box( 'postexcerpt','post','normal' ); // 抜粋 // remove_meta_box( 'commentstatusdiv','post','normal' ); // コメント // remove_meta_box( 'trackbacksdiv','post','normal' ); // トラックバック // remove_meta_box( 'slugdiv','post','normal' ); // スラッグ // remove_meta_box( 'authordiv','post','normal' ); // 作成者 } add_action('admin_menu','remove_default_post_screen_metaboxes'); /*-------------------------------------------*/ /* カスタム投稿タイプ_お知らせの追加 /*-------------------------------------------*/ add_action( 'init', 'create_post_type', 0 ); function create_post_type() { register_post_type( 'info', /* post-type */ array( 'labels' => array( 'name' => 'お知らせ', 'singular_name' => 'お知らせ一覧' ), 'public' => true, 'menu_position' =>5, 'has_archive' => 'info/archive/', 'supports' => array('title','editor','excerpt','thumbnail') ) ); // お知らせのカテゴリーを設定 register_taxonomy( 'info-cat', 'info', array( 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => 'お知らせカテゴリー', 'singular_label' => 'お知らせカテゴリー', 'public' => true, 'show_ui' => true, 'menu-order' => true, ) ); } add_action( 'generate_rewrite_rules', 'my_rewrite' ); function my_rewrite( $wp_rewrite ){ $taxonomies = get_taxonomies(); $taxonomies = array_slice($taxonomies,4,count($taxonomies)-1); foreach ( $taxonomies as $taxonomy ) : $post_types = get_taxonomy($taxonomy)->object_type; foreach ($post_types as $post_type){ $new_rules[$post_type.'/'.$taxonomy.'/(.+?)/?$'] = 'index.php?taxonomy='.$taxonomy.'&term='.$wp_rewrite->preg_index(1); } $wp_rewrite->rules = array_merge($new_rules, $wp_rewrite->rules); endforeach; } /* カスタム投稿タイプのアーカイブ出力 /*-------------------------------------------*/ global $my_archives_post_type; add_filter( 'getarchives_where', 'my_getarchives_where', 10, 2 ); function my_getarchives_where( $where, $r ) { global $my_archives_post_type; if ( isset($r['post_type']) ) { $my_archives_post_type = $r['post_type']; $where = str_replace( '\'post\'', '\'' . $r['post_type'] . '\'', $where ); } else { $my_archives_post_type = ''; } return $where; } add_filter( 'get_archives_link', 'my_get_archives_link' ); function my_get_archives_link( $link_html ) { global $my_archives_post_type; if ( '' != $my_archives_post_type ) $add_link .= '?post_type=' . $my_archives_post_type; $link_html = preg_replace("/href=\'(.+)\'\s/","href='$1".$add_link."'",$link_html); return $link_html; } /*-------------------------------------------*/ /* head_description 生成 /*-------------------------------------------*/ function getHeadDescription() { global $wp_query; $post = $wp_query->get_queried_object(); // ▼トップページ if (is_home() || is_page('home') || is_front_page()) { $metadescription = get_bloginfo( 'description' ); // ▼カテゴリーページ } else if (is_category() || is_tax()) { $metadescription = $post->category_description; if ( ! $metadescription ) { $metadescription = single_cat_title()."について。".get_bloginfo('description'); } // ▼タグアーカイブ */ } else if (is_tag()) { $metadescription = strip_tags(tag_description()); $metadescription = str_replace(array("\r\n","\r","\n"), '', $metadescription); // 改行コード削除 if ( ! $metadescription ) { $metadescription = single_tag_title()."について。".get_bloginfo('name').get_bloginfo('description'); } // ▼アーカイブ */ } else if (is_archive()) { $metadescription = get_the_time('Y')."年の投稿。".get_bloginfo('name').get_bloginfo('description'); // ▼固定ページ || 投稿記事 } else if (is_page() || is_single) { $metaExcerpt = $post->post_excerpt; if ($metaExcerpt) { $metadescription = $post->post_excerpt; } else { $metadescription = mb_substr( strip_tags($post->post_content), 0, 240 ); // タグを無効化して240文字でトリム $metadescription = str_replace(array("\r\n","\r","\n"), ' ', $metadescription); // 改行コード削除 } // ▼それ以外 } else { $metadescription = get_bloginfo('description'); } echo $metadescription; } /*-------------------------------------------*/ /* head_wp_head が吐き出す項目を追加・削除 /*-------------------------------------------*/ // WordPressの情報を削除 remove_action('wp_head', 'wp_generator'); // prev,nextを削除 remove_action('wp_head','adjacent_posts_rel_link_wp_head',10); // Google Web Fonts を追加 add_action('wp_head','bizVektorAddWebFonts'); function bizVektorAddWebFonts(){ $webFonts = ''."\n"; $webFonts = apply_filters('webFontsCustom', $webFonts ); echo $webFonts; } // オプションのスタイルを追加 add_action('wp_head','bizVektorAddOptionStyle'); function bizVektorAddOptionStyle(){ $optionStyle = ''."\n"; $optionStyle = apply_filters('optionStyleCustom', $optionStyle ); echo $optionStyle; } // SNS連携のスタイルを追加 add_action('wp_head','bizVektorAddSnsStyle'); function bizVektorAddSnsStyle(){ $snsStyle = ''."\n"; $snsStyle = apply_filters('snsStyleCustom', $snsStyle ); echo $snsStyle; } // pingbackを追加 add_action('wp_head','bizVektorAddPingback'); function bizVektorAddPingback(){ $pingback = ''."\n"; $pingback = apply_filters('pingbackCustom', $pingback ); echo $pingback; } /*-------------------------------------------*/ /* カスタム分類名をaタグ無しで出力する /*-------------------------------------------*/ function get_the_term_list_nolink( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) { $terms = get_the_terms( $id, $taxonomy ); if ( is_wp_error( $terms ) ) return $terms; if ( empty( $terms ) ) return false; foreach ( $terms as $term ) { $term_names[] = $term->name ; } return $before . join( $sep, $term_names ) . $after; } /*-------------------------------------------*/ /* ナビゲーションメニューの英語併記 /*-------------------------------------------*/ class description_walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $class_names = ' class="'. esc_attr( $class_names ) . '"'; $output .= $indent . '@', '\1', $html); } add_filter('get_archives_link', 'my_archives_link'); /*-------------------------------------------*/ /* カテゴリー件数をの中に置換 /*-------------------------------------------*/ function my_list_categories( $output, $args ) { $output = preg_replace('/<\/a>\s*\((\d+)\)/',' ($1)',$output); return $output; } add_filter( 'wp_list_categories', 'my_list_categories', 10, 2 ); /*-------------------------------------------*/ /* TinyMCEでiframeタグ(GoogleMapなど)の自動消去禁止指定 /*-------------------------------------------*/ function add_iframe($initArray) { $initArray['extended_valid_elements'] = "iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]"; return $initArray; } add_filter('tiny_mce_before_init', 'add_iframe'); /*-------------------------------------------*/ /* 画像挿入時のwidthとheight指定削除 /* (スマホ表示の際に画像サイズ自動調整がうまくいかない為) /* → キャプションが入らなくなる為削除。サイズは!importantで調整 /*-------------------------------------------*/ /* function remove_hwstring_from_image_tag( $html, $id, $caption, $title, $align, $url, $size ) { list( $img_src, $width, $height ) = image_downsize($id, $size); $hwstring = image_hwstring( $width, $height ); $html = str_replace( $hwstring, '', $html ); return $html; } add_filter( 'image_send_to_editor', 'remove_hwstring_from_image_tag', 10, 7 ); */ /*-------------------------------------------*/ /* Comment /*-------------------------------------------*/ if ( ! function_exists( 'biz_vektor_comment' ) ) : function biz_vektor_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    %s', get_comment_author_link() ) ); ?>
    comment_approved == '0' ) : ?> あなたのコメントは承認待ちです。
    '返信', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  • Pingback: (', ')' ); ?> max_num_pages > 1 ) : ?>

    ナビゲーション

    max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "
    Page ".$paged." / ".$pages.""; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "«"; if($paged > 1 && $showitems < $pages) echo ""; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "".$i."":"".$i.""; } } if ($paged < $pages && $showitems < $pages) echo ""; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "»"; echo "
    \n"; } } // ▲ページング /*-------------------------------------------*/ /* Comment out short code /*-------------------------------------------*/ /* 本文欄で一時的に非表示にしたい箇所がある場合、 htmlモードで該当箇所を[ignore][/ignore]で囲うと、コメントアウトが出来ます。 */ function ignore_shortcode( $atts, $content = null ) { return null; } add_shortcode('ignore', 'ignore_shortcode');