' . '
'; add_contextual_help( $theme_page, $help ); */ } add_action( 'admin_menu', 'biz_vektor_theme_options_add_page' ); /*-------------------------------------------*/ /* テーマオプションの編集権限設定 /*-------------------------------------------*/ function biz_vektor_option_page_capability( $capability ) { return 'edit_theme_options'; } add_filter( 'option_page_capability_biz_vektor_options', 'biz_vektor_option_page_capability' ); /*-------------------------------------------*/ /* テーマオプションの編集画面の読み込み /*-------------------------------------------*/ get_template_part('inc/theme-options-edit'); /*-------------------------------------------*/ /* Create title /*-------------------------------------------*/ function getHeadTitle() { $options = biz_vektor_get_theme_options(); global $wp_query; $post = $wp_query->get_queried_object(); if (is_front_page()) { if (isset($options['topTitle']) && $options['topTitle']) { $headTitle = $options['topTitle']; } else { $headTitle = get_bloginfo('name'); } } else if (is_home()) { if (isset($options['postLabelName']) && $options['postLabelName']) { $headTitle = $options['postLabelName']." | ".get_bloginfo('name'); } else { $headTitle = get_bloginfo('name'); } // Author } else if (is_author()) { $userObj = get_queried_object(); $headTitle = esc_html($userObj->display_name)." | ".get_bloginfo('name'); // Page } else if (is_page()) { // Sub Pages 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'); // Not Sub Pages } else { $headTitle = get_the_title()." | ".get_bloginfo('name'); } // Info } else if (get_post_type() === 'info') { // Single if (is_single()) { $taxo_catelist = get_the_term_list_nolink( 'info-cat', $post->ID, '', ',', '' ); if (!empty($taxo_catelist)) : $headTitle = get_the_title()." | ".$taxo_catelist." | ".get_bloginfo('name'); else : $headTitle = get_the_title()." | ".get_bloginfo('name'); endif; // Info category } else if (is_tax()){ $headTitle = single_cat_title('',false)." | ".get_bloginfo('name'); // Info crchive } else if (is_archive()) { if ( is_year()) { $headTitle = sprintf( __( 'Yearly Archives: %s', 'biz-vektor' ), get_the_date( _x( 'Y', 'yearly archives date format', 'biz-vektor' ) ) ); } if ( is_month()) { $headTitle = sprintf( __( 'Monthly Archives: %s', 'biz-vektor' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'biz-vektor' ) ) ); } else { $headTitle = esc_html(bizVektorOptions('infoLabelName')); } $headTitle .= " | ".get_bloginfo('name'); } // Single } 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; // Category } else if (is_category()) { $headTitle = single_cat_title('',false)." | ".get_bloginfo('name'); // Tag } else if (is_tag()) { $headTitle = single_tag_title('',false)." | ".get_bloginfo('name'); // Archive } else if (is_archive()) { if (is_month()){ $headTitle = sprintf( __( 'Monthly Archives: %s', 'biz-vektor' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'biz-vektor' ) ) ); } else if (is_year()){ $headTitle = sprintf( __( 'Yearly Archives: %s', 'biz-vektor' ), get_the_date( _x( 'Y', 'yearly archives date format', 'biz-vektor' ) ) ); } else if (is_tax()){ $headTitle = single_term_title('',false); } else if (!is_day() || !is_tax()){ global $wp_query; $postTypeName = esc_html($wp_query->queried_object->labels->name); $headTitle = $postTypeName; } $headTitle .= " | ".get_bloginfo('name'); // Search } else if (is_search()) { $headTitle = sprintf(__('Search Results for : %s', 'biz-vektor'),get_search_query())." | ".get_bloginfo('name'); //Other } else { $headTitle = get_bloginfo('name'); } global $paged; if ( $paged != '0' ){ $headTitle = '['.sprintf(__('Page of %s', 'biz-vektor' ),$paged).'] '.$headTitle; } $headTitle = apply_filters( 'titleCustom', $headTitle ); return strip_tags($headTitle); } add_filter( 'wp_title', 'getHeadTitle', 10, 2 ); /*-------------------------------------------*/ /* layout /*-------------------------------------------*/ function biz_vektor_layouts() { $layout_options = array( 'sidebar-content' => array( 'value' => 'sidebar-content', 'label' => __('Left sidebar', 'biz-vektor'), 'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png', ), 'content-sidebar' => array( 'value' => 'content-sidebar', 'label' => __('Right sidebar', 'biz-vektor'), 'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png', ), ); return apply_filters( 'biz_vektor_layouts', $layout_options ); } /*-------------------------------------------*/ /* Add layout class to body tag /*-------------------------------------------*/ function biz_vektor_layout_classes( $existing_classes ) { $options = biz_vektor_get_theme_options(); if (isset($options['theme_layout'])) { $current_layout = $options['theme_layout']; // if $options['theme_layout'] include 'content-sidebar' or 'sidebar-content' if ( in_array( $current_layout, array( 'content-sidebar', 'sidebar-content' ) ) ) // Set the classname 'two-column' to $classes $classes = array( 'two-column' ); if ( 'content-sidebar' == $current_layout ) $classes[] = 'right-sidebar'; elseif ( 'sidebar-content' == $current_layout ) $classes[] = 'left-sidebar'; else $classes[] = $current_layout; } else { $current_layout = array(); $classes = array(); } $classes = apply_filters( 'biz_vektor_layout_classes', $classes, $current_layout ); return array_merge( $existing_classes, $classes ); } add_filter( 'body_class', 'biz_vektor_layout_classes' ); /*-------------------------------------------*/ /* Add to the body tag class to turn off the side bar /*-------------------------------------------*/ function biz_vektor_topSideBarDisplay( $existing_classes ) { if (is_front_page()){ $options = biz_vektor_get_theme_options(); if ($options['topSideBarDisplay'] ){ $classes[] = 'one-column'; // remove layout class $existing_classes = array_diff( $existing_classes , array('right-sidebar','left-sidebar','two-column') ); // merge 'one-column' $existing_classes = array_merge( $existing_classes, $classes ); } } return $existing_classes; } add_filter( 'biz_vektor_layout_classes', 'biz_vektor_topSideBarDisplay' ); /*-------------------------------------------*/ /* Theme style /*-------------------------------------------*/ // [1] Set theme style array function biz_vektor_theme_styleSetting() { global $biz_vektor_theme_styles; $biz_vektor_theme_styles = array( 'rebuild' => array( 'label' => 'Rebuild', 'cssPath' => get_template_directory_uri().'/design_skins/003/css/003.css', 'cssPathOldIe' => get_template_directory_uri().'/design_skins/003/css/003_oldie.css', ), 'calmly' => array( 'label' => 'Calmly', 'cssPath' => get_template_directory_uri().'/design_skins/002/002.css', 'cssPathOldIe' => get_template_directory_uri().'/design_skins/002/002_oldie.css', ), 'plain' => array( 'label' => __('Plain', 'biz-vektor'), 'cssPath' => get_template_directory_uri().'/design_skins/plain/plain.css', 'cssPathOldIe' => get_template_directory_uri().'/design_skins/plain/plain_oldie.css', ), 'default' => array( 'label' => 'Default', 'cssPath' => get_template_directory_uri().'/design_skins/001/001.css', 'cssPathOldIe' => get_template_directory_uri().'/design_skins/001/001_oldie.css', ), ); // [2] Receive 'theme style array' from the plug-in $biz_vektor_theme_styles = apply_filters( 'biz_vektor_themePlus', $biz_vektor_theme_styles ); } // [4] Print theme style css add_action('wp_enqueue_scripts','biz_vektor_theme_style',100 ); function biz_vektor_theme_style() { $options = biz_vektor_get_theme_options(); // Set bbiz_vektor_theme_styles global $biz_vektor_theme_styles; biz_vektor_theme_styleSetting(); if ( isset($options['theme_style']) ) { $theme_style = $options['theme_style']; /* 一度保存されているラベルのスキンプラグインが停止またはアンインストールされている事があるので、 保存されているスキンが使用出来るか判別するために変数の配列を確認。なければ変わりにrebuildを適用する */ if ( !isset($biz_vektor_theme_styles[$theme_style]) ) { $theme_style = 'rebuild'; } } else { // set default style $theme_style = 'rebuild'; } // wp_enqueue_style( 'theme', $themePath , false, '2013-10-19'); $themePath = $biz_vektor_theme_styles[$theme_style]['cssPath']; $system_name = get_biz_vektor_name(); $version = ( isset($biz_vektor_theme_styles[$theme_style]['ver']) )? $biz_vektor_theme_styles[$theme_style]['ver']: BizVektor_Theme_Version; wp_enqueue_style('Biz_Vektor_Design_style', $themePath, array('Biz_Vektor_common_style'), $version, 'all'); } add_action('wp_head','biz_vektor_theme_style_oldie',100 ); function biz_vektor_theme_style_oldie() { global $biz_vektor_theme_styles; biz_vektor_theme_styleSetting(); if ( isset($options['theme_style']) ) { $theme_style = $options['theme_style']; /* 一度保存されているラベルのスキンプラグインが停止またはアンインストールされている事があるので、 保存されているスキンが使用出来るか判別するために変数の配列を確認。なければ変わりにrebuildを適用する */ if ( !isset($biz_vektor_theme_styles[$theme_style]) ) { $theme_style = 'rebuild'; } } else { // set default style $theme_style = 'rebuild'; } } /*-------------------------------------------*/ /* Favicon /*-------------------------------------------*/ function biz_vektor_favicon(){ $options = biz_vektor_get_theme_options(); if(isset($options['favicon']) && $options['favicon']){ echo ''; } } add_action('wp_head', 'biz_vektor_favicon'); add_action('admin_head', 'biz_vektor_favicon'); /*-------------------------------------------*/ /* Menu divide /*-------------------------------------------*/ add_action('wp_head','biz_vektor_gMenuDivide',170 ); function biz_vektor_gMenuDivide() { $options = biz_vektor_get_theme_options(); // No select if ($options['gMenuDivide'] == __('[ Select ]', 'biz-vektor') || ! $options['gMenuDivide'] || ($options['gMenuDivide'] == 'divide_natural') ) { // other } else { $menuWidth = array( 'divide_4' => array(238,237), 'divide_5' => array(193,189), 'divide_6' => array(159,158), 'divide_7' => array(139,135), ); $menuWidthActive = $menuWidth[$options['gMenuDivide']][0]; $menuWidthNonActive = $menuWidth[$options['gMenuDivide']][1]; ?> '; } else { bloginfo('name'); } } /*-------------------------------------------*/ /* Header contact info (TEL & Time) /*-------------------------------------------*/ function biz_vektor_print_headContact() { $options = biz_vektor_get_theme_options(); $contact_txt = $options['contact_txt']; $contact_time = nl2br($options['contact_time']); $headContact = ''; if ($options['tel_number']) { // tel_number $headContact = '