' . '
'; add_contextual_help( $theme_page, $help ); */ } add_action( 'admin_menu', 'biz_vektor_theme_options_add_page' ); /*-------------------------------------------*/ /* title 生成 /*-------------------------------------------*/ function getHeadTitle() { $options = biz_vektor_get_theme_options(); global $wp_query; $post = $wp_query->get_queried_object(); if (is_home() || is_page('home') || is_front_page()) { if ($options['topTitle']) { $headTitle = $options['topTitle']; } else { $headTitle = get_bloginfo('name'); } // ▼投稿者ページ } else if (is_author()) { $userObj = get_queried_object(); $headTitle = esc_html($userObj->display_name)." | ".get_bloginfo('name'); // ▼固定ページ } else if (is_page()) { // ▼サブページの場合 if ( $post->post_parent ) { if($post->ancestors){ foreach($post->ancestors as $post_anc_id){ $post_id = $post_anc_id; } } else { $post_id = $post->ID; } $headTitle = get_the_title()." | ".get_the_title($post_id)." | ".get_bloginfo('name'); // ▼サブページではない場合 } else { $headTitle = get_the_title()." | ".get_bloginfo('name'); } // ▼お知らせ } else if (get_post_type() === 'info') { // ▼お知らせ if (is_single()) { $taxo_catelist = get_the_term_list_nolink( $post->ID, 'info-cat', '', ',', '' ); if (!empty($taxo_catelist)) : $headTitle = get_the_title()." | ".$taxo_catelist." | ".get_bloginfo('name'); else : $headTitle = get_the_title()." | ".get_bloginfo('name'); endif; // ▼お知らせカテゴリー } else if (is_tax()){ $headTitle = single_cat_title()." | ".get_bloginfo('name'); // ▼お知らせアーカイブ } else if (is_archive()) { $headTitle = get_the_date('Y')."年 | ".get_bloginfo('name'); } // ▼投稿記事 } else if (is_single()) { $category = get_the_category(); if (!empty($category)) : $headTitle = get_the_title()." | ".$category[0]->cat_name." | ".get_bloginfo('name'); else : $headTitle = get_the_title()." | ".get_bloginfo('name'); endif; // ▼投稿カテゴリーページ } else if (is_category()) { $headTitle = single_cat_title()." | ".get_bloginfo('name'); // ▼タグアーカイブ */ } else if (is_tag()) { $headTitle = single_tag_title()." | ".get_bloginfo('name'); // ▼投稿アーカイブページ } else if (is_archive()) { if (is_date()){ $headTitle = get_the_date('Y'."年".'M')." | ".get_bloginfo('name'); } else { $headTitle = single_tag_title(); } // ▼検索結果 } else if (is_search()) { $headTitle = get_search_query()."の検索結果 | ".get_bloginfo('name'); // ▼それ以外 } else { $headTitle = get_bloginfo('name'); } $headTitle = apply_filters( 'titleCustom', $headTitle ); echo $headTitle; } /*-------------------------------------------*/ /* レイアウト /*-------------------------------------------*/ function biz_vektor_layouts() { $layout_options = array( 'content-sidebar' => array( 'value' => 'content-sidebar', 'label' => '右サイドバー', 'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png', ), 'sidebar-content' => array( 'value' => 'sidebar-content', 'label' => '左サイドバー', 'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png', ), ); return apply_filters( 'biz_vektor_layouts', $layout_options ); } function biz_vektor_get_default_theme_options() { $default_theme_options = array( 'theme_layout' => 'content-sidebar', ); } function biz_vektor_get_theme_options() { return get_option( 'biz_vektor_theme_options', biz_vektor_get_default_theme_options() ); } /*-------------------------------------------*/ /* bodyタグにレイアウトのクラス追加 /*-------------------------------------------*/ function biz_vektor_layout_classes( $existing_classes ) { $options = biz_vektor_get_theme_options(); $current_layout = $options['theme_layout']; if ( in_array( $current_layout, array( 'content-sidebar', 'sidebar-content' ) ) ) $classes = array( 'two-column' ); if ( 'content-sidebar' == $current_layout ) $classes[] = 'right-sidebar'; elseif ( 'sidebar-content' == $current_layout ) $classes[] = 'left-sidebar'; else $classes[] = $current_layout; $classes = apply_filters( 'biz_vektor_layout_classes', $classes, $current_layout ); return array_merge( $existing_classes, $classes ); } add_filter( 'body_class', 'biz_vektor_layout_classes' ); /*-------------------------------------------*/ /* bodyタグにトップページでサイドバー非表示に設定されていた場合のクラス制御追加 /*-------------------------------------------*/ function biz_vektor_topSideBarDisplay( $existing_classes ) { // $existing_classesは既に存在するbodyのclass // トップページでのみ実行 if (is_front_page()){ $options = biz_vektor_get_theme_options(); if ($options['topSideBarDisplay'] ){ $classes[] = 'one-column'; // 既に存在するbodyの配列から指定の配列名を削除 $existing_classes = array_diff( $existing_classes , array('right-sidebar','left-sidebar','two-column') ); // 既に存在したclass($existing_classes)と今回追加したclass($classes)をマージ $existing_classes = array_merge( $existing_classes, $classes ); } } // bodyのclassを返す return $existing_classes; } add_filter( 'biz_vektor_layout_classes', 'biz_vektor_topSideBarDisplay' ); /*-------------------------------------------*/ /* テーマオプション入力画面 /*-------------------------------------------*/ get_template_part('inc/theme-options-edit'); /*-------------------------------------------*/ /* テーマスタイル /*-------------------------------------------*/ // [1] テーマ配列読み込み function biz_vektor_theme_styleSetting() { global $biz_vektor_theme_styles; $biz_vektor_theme_styles = array( 'calmly' => array( 'label' => 'Calmly', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/002/002.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/002/002_oldIE.css', ), 'plain' => array( 'label' => 'プレーン', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/plain/plain.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/plain/plain_oldIE.css', ), '001_red' => array( 'label' => 'Default_赤', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/001/001_red.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/001/001_oldIE.css', ), '001_bizblue' => array( 'label' => 'Default_紺', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/001/001_bizblue.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/001/001_oldIE.css', ), '001_green' => array( 'label' => 'Default_緑', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/001/001_green.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/001/001_oldIE.css', ), '001_bizgreen' => array( 'label' => 'Default_深緑', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/001/001_bizgreen.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/001/001_oldIE.css', ), '001_black' => array( 'label' => 'Default_黒', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/001/001_black.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/001/001_oldIE.css', ), '001_daidai' => array( 'label' => 'Default_橙', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/001/001_daidai.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/001/001_oldIE.css', ), '001_darkbrown' => array( 'label' => 'Default_焦茶', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/001/001_darkbrown.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/001/001_oldIE.css', ), ); // [2] プラグインからフィルターフックで拡張テーマの配列情報を受け取る $biz_vektor_theme_styles = apply_filters( 'biz_vektor_themePlus', $biz_vektor_theme_styles ); } /* [3] 管理画面のデザイン選択プルダウンで$biz_vektor_theme_stylesを読み込み。 第一引数を valueとして $options[theme_style] に格納 第一引数の配列のlavel $biz_vektor_theme_styleValues['label'] をプルダウン項目として表示。*/ // [4] ヘッダーにスタイルを書き出す function biz_vektor_theme_style() { // DBに入っている配列を読み込み $options = biz_vektor_get_theme_options(); // biz_vektor_theme_styles配列読み込み global $biz_vektor_theme_styles; biz_vektor_theme_styleSetting(); $themePath = $biz_vektor_theme_styles[$options['theme_style']]['cssPath']; // 空の場合(テーマ選択されていない場合)デフォルトの値を設定 if (!$themePath) { $themePath = get_template_directory_uri().'/bizvektor_themes/002/002.css'; } // 基本スタイルのCSSを出力 wp_enqueue_style( 'theme', $themePath , false, '2013-01-31'); } // ▼レスポンシブに非対応なIE8以前用 function biz_vektor_theme_styleOldIe(){ // DBに入っている配列を読み込み $options = biz_vektor_get_theme_options(); // biz_vektor_theme_styles配列読から旧IE用のバスを読み込んで$themePathOldIeに格納 global $biz_vektor_theme_styles; biz_vektor_theme_styleSetting(); $themePathOldIe = $biz_vektor_theme_styles[$options['theme_style']]['cssPathOldIe']; $themePath = $biz_vektor_theme_styles[$options['theme_style']]['cssPath']; $themePathOldIe = $biz_vektor_theme_styles[$options['theme_style']]['cssPathOldIe']; // 空の場合(テーマ選択されていない場合)デフォルトの値を設定 if (!$themePath && !$themePathOldIe) $themePathOldIe = get_template_directory_uri().'/bizvektor_themes/002/002_oldIE.css'; // $themePathOldIeを意図的に空にする場合はあり得る為、空かどうかの条件分岐は必要 if ($themePathOldIe){ print ''."\n"; } } /*-------------------------------------------*/ /* メニューボタンの数 /*-------------------------------------------*/ function biz_vektor_gMenuDivide() { $options = biz_vektor_get_theme_options(); // メニューボタンが未設定の場合 if ($options['gMenuDivide'] == '[ 選択して下さい ]' || ! $options['gMenuDivide'] || ($options['gMenuDivide'] == 'divide_natural') ) { // それ以外 } else { print ''."\n"; print ''."\n"; } } /*-------------------------------------------*/ /* ヘッダーロゴ /*-------------------------------------------*/ function biz_vektor_print_headLogo() { $options = biz_vektor_get_theme_options(); $head_logo = $options['head_logo']; if ($options['head_logo']) { print '; ?>/images/bnr_facebook.png)
; ?>/images/bnr_twitter.png)