' . '

'; add_contextual_help( $theme_page, $help ); */ } add_action( 'admin_menu', 'biz_vektor_theme_options_add_page' ); /*-------------------------------------------*/ /* Create 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'); } // 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( $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; // Info category } else if (is_tax()){ $headTitle = single_cat_title()." | ".get_bloginfo('name'); // Info crchive } else if (is_archive()) { $headTitle = sprintf( __( 'Yearly Archives: %s', 'biz-vektor' ), get_the_date( _x( 'Y', 'yearly archives date format', 'biz-vektor' ) ) ); $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()." | ".get_bloginfo('name'); // Tag } else if (is_tag()) { $headTitle = single_tag_title()." | ".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' ) ) ); $headTitle .= " | ".get_bloginfo('name'); } else { $headTitle = single_tag_title(); } // Search } else if (is_search()) { $headTitle = sprintf(__('Search Result for : %s', 'biz-vektor'),get_search_query())." | ".get_bloginfo('name'); //Other } else { $headTitle = get_bloginfo('name'); } $headTitle = apply_filters( 'titleCustom', $headTitle ); echo $headTitle; } /*-------------------------------------------*/ /* layout /*-------------------------------------------*/ function biz_vektor_layouts() { $layout_options = array( 'content-sidebar' => array( 'value' => 'content-sidebar', 'label' => __('Right sidebar', 'biz-vektor'), 'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png', ), 'sidebar-content' => array( 'value' => 'sidebar-content', 'label' => __('Left sidebar', 'biz-vektor'), '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() ); } /*-------------------------------------------*/ /* Add layout class to body tag /*-------------------------------------------*/ 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' ); /*-------------------------------------------*/ /* 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 option edit /*-------------------------------------------*/ get_template_part('inc/theme-options-edit'); /*-------------------------------------------*/ /* Theme style /*-------------------------------------------*/ // [1] Set theme style array 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' => __('Plain', 'biz-vektor'), 'cssPath' => get_template_directory_uri().'/bizvektor_themes/plain/plain.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/plain/plain_oldie.css', ), 'default' => array( 'label' => 'Default', 'cssPath' => get_template_directory_uri().'/bizvektor_themes/001/001.css', 'cssPathOldIe' => get_template_directory_uri().'/bizvektor_themes/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 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(); // load default if ( !$options['theme_style'] ) { global $bizVektorOptions_default; bizVektorOptions_default(); $options['theme_style'] = $bizVektorOptions_default['theme_style']; } $themePath = $biz_vektor_theme_styles[$options['theme_style']]['cssPath']; wp_enqueue_style( 'theme', $themePath , false, '2013-10-19'); } // fuck IE function biz_vektor_theme_styleOldIe(){ $options = biz_vektor_get_theme_options(); 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']; // Necessary if ($themePathOldIe){ print ''."\n"; } } /*-------------------------------------------*/ /* Menu divide /*-------------------------------------------*/ 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 { print ''."\n"; print ''."\n"; } } /*-------------------------------------------*/ /* Header logo /*-------------------------------------------*/ function biz_vektor_print_headLogo() { $options = biz_vektor_get_theme_options(); $head_logo = $options['head_logo']; if ($options['head_logo']) { print ''.get_bloginfo('name').''; } else { echo 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']); if ($options['tel_number']) { // tel_number $headContact = '
'."\n"; if ($contact_txt) { // contact_txt $headContact .= '
'.$contact_txt.'
'."\n"; } // mobile if ( function_exists('wp_is_mobile') && wp_is_mobile() ) { $headContact .= ''."\n"; // not mobile } else { $headContact .= '
TEL '.$options['tel_number'].'
'."\n"; } if ($contact_time) { // contact_time $headContact .= '
'.$contact_time.'
'."\n"; } $headContact .= '
'; } // set filter to $headContact $headContact = apply_filters( 'headContactCustom', $headContact ); echo $headContact; } /*-------------------------------------------*/ /* facebook twitter banner /*-------------------------------------------*/ function biz_vektor_snsBnrs() { $options = biz_vektor_get_theme_options(); $facebook = $options['facebook']; $twitter = $options['twitter']; if ($facebook || $twitter) { print '"; ?> '."\n"; echo $topContentsBottom; if ( is_user_logged_in() == TRUE ) { echo '
'."\n"; echo ''; echo __('Edit', 'biz-vektor'); echo ''."\n"; echo '
'."\n"; } echo ''."\n"; } } /*-------------------------------------------*/ /* Add OGP /*-------------------------------------------*/ function biz_vektor_ogp () { $options = biz_vektor_get_theme_options(); //$ogpImage = $options['ogpImage']; //$fbAppId = $options['fbAppId']; global $wp_query; $post = $wp_query->get_queried_object(); if (is_home() || is_front_page()) { $linkUrl = home_url(); } else if (is_single() || is_page()) { $linkUrl = get_permalink(); } else { $linkUrl = get_permalink(); } $bizVektorOGP = ''."\n"; $bizVektorOGP .= ''."\n"; if ($options['fbAppId']){ $bizVektorOGP = $bizVektorOGP.''."\n"; } if (is_front_page() || is_home()) { $bizVektorOGP .= ''."\n"; if ($options['ogpImage']){ $bizVektorOGP .= ''."\n"; } $bizVektorOGP .= ''."\n"; $bizVektorOGP .= ''."\n"; } else if (is_category() || is_archive()) { $bizVektorOGP .= ''."\n"; if ($options['ogpImage']){ $bizVektorOGP .= ''."\n"; } } else if (is_page() || is_single()) { $bizVektorOGP .= ''."\n"; // image if (has_post_thumbnail()) { $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'large', true); $bizVektorOGP .= ''."\n"; } else if ($options['ogpImage']){ $bizVektorOGP .= ''."\n"; } // description $metaExcerpt = $post->post_excerpt; if ($metaExcerpt) { $metadescription = $post->post_excerpt; } else { $metadescription = mb_substr( strip_tags($post->post_content), 0, 240 ); // kill tags and trim 240 chara $metadescription = str_replace(array("\r\n","\r","\n"), ' ', $metadescription); } $bizVektorOGP .= ''."\n"; $bizVektorOGP .= ''."\n"; } else { $bizVektorOGP .= ''."\n"; if ($options['ogpImage']){ $bizVektorOGP .= ''."\n"; } } if ( $options['ogpTagDisplay'] == 'ogp_off' ) { $bizVektorOGP = ''; } $bizVektorOGP = apply_filters('bizVektorOGPCustom', $bizVektorOGP ); echo $bizVektorOGP; } /*-------------------------------------------*/ /* mainfoot _ contact /*-------------------------------------------*/ function biz_vektor_mainfootContact() { $options = biz_vektor_get_theme_options(); $contact_txt = $options['contact_txt']; $contact_time = nl2br($options['contact_time']); if ($contact_txt) { print ''.$contact_txt.''."\n"; } if ($options['tel_number']) { // mobile if ( function_exists('wp_is_mobile') && wp_is_mobile() ) { echo 'TEL '.$options['tel_number'].''."\n"; // not mobile } else { echo 'TEL '.$options['tel_number'].''."\n"; } if ($contact_time) { print ''.$contact_time.''."\n"; } } } /*-------------------------------------------*/ /* snsBtns /*-------------------------------------------*/ function twitterID() { $options = biz_vektor_get_theme_options(); return $options['twitter']; } /*-------------------------------------------*/ /* snsBtns _ display page /*-------------------------------------------*/ function biz_vektor_snsBtns() { $options = biz_vektor_get_theme_options(); $snsBtnsFront = $options['snsBtnsFront']; $snsBtnsPage = $options['snsBtnsPage']; $snsBtnsPost = $options['snsBtnsPost']; $snsBtnsInfo = $options['snsBtnsInfo']; $snsBtnsHidden = $options['snsBtnsHidden']; global $wp_query; $post = $wp_query->get_queried_object(); $snsHiddenFlag = false; // $snsBtnsHidden divide "," and insert to $snsHiddens by array $snsHiddens = spliti(",",$snsBtnsHidden); foreach( $snsHiddens as $snsHidden ){ if (get_the_ID() == $snsHidden) { $snsHiddenFlag = true ; } } wp_reset_query(); if (!$snsHiddenFlag) { if ( ( is_front_page() && $snsBtnsFront ) || ( is_page() && $snsBtnsPage && !is_front_page() ) || ( get_post_type() == 'info' && $snsBtnsInfo ) || ( get_post_type() == 'post' && $snsBtnsPost ) ) { get_template_part('module_snsBtns'); } } } /*-------------------------------------------*/ /* facebook comment display page /*-------------------------------------------*/ function biz_vektor_fbComments() { $options = biz_vektor_get_theme_options(); global $wp_query; $post = $wp_query->get_queried_object(); $fbCommentHiddenFlag = false ; // is stored as an array to $snsHiddens to split with "," $snsBtnsHidden $fbCommentHiddens = spliti(",",$options['fbCommentsHidden']); foreach( $fbCommentHiddens as $fbCommentHidden ){ if (get_the_ID() == $fbCommentHidden) { $fbCommentHiddenFlag = true ; } } wp_reset_query(); if (!$fbCommentHiddenFlag) { if ( ( is_front_page() && $options['fbCommentsFront'] ) || ( is_page() && $options['fbCommentsPage'] && !is_front_page() ) || ( get_post_type() == 'info' && $options['fbCommentsInfo'] ) || ( get_post_type() == 'post' && $options['fbCommentsPost'] ) ) { ?>
data-show-faces="" data-stream="" data-header="true">
'; } else { echo $footSiteName; } } function biz_vektor_print_footContact() { $options = biz_vektor_get_theme_options(); $contact_address = wp_kses_post(nl2br($options['contact_address'])); if ($contact_address) { print $contact_address; } } function biz_vektor_footerCopyRight() { $options = biz_vektor_get_theme_options(); $subSiteName = ($options['sub_sitename']); print '
Copyright © '; if ($subSiteName) { print $subSiteName; } else { bloginfo( 'name' ); } print ' All Rights Reserved.
'; // **** Don't change id name! $footerPowerd = '
Powered by WordPress & BizVektor Theme by Vektor,Inc. technology.
'; // **** Dont change filter name! Oh I already know 'Powerd' id miss spell !!!!! $footerPowerd = apply_filters( 'footerPowerdCustom', $footerPowerd ); echo $footerPowerd; } /*-------------------------------------------*/ /* slide show /*-------------------------------------------*/ function biz_vektor_slideExist () { $options = biz_vektor_get_theme_options(); if ( ($options['slide1image'] && (!$options['slide1display'])) || ($options['slide2image'] && (!$options['slide2display'])) || ($options['slide3image'] && (!$options['slide3display'])) || ($options['slide4image'] && (!$options['slide4display'])) || ($options['slide5image'] && (!$options['slide5display'])) ){ return true; } } function biz_vektor_slideBody(){ $options = biz_vektor_get_theme_options(); for ( $i = 1; $i <= 5 ; $i++){ if ($options['slide'.$i.'image']) { if (!$options['slide'.$i.'display']) { print '
  • '; if ($options['slide'.$i.'link']) { $blank = ""; if ($options['slide'.$i.'blank']) : $blank = ' target="_blank"'; endif; print ''; } else { print ''; } print ''.$options['slide'.$i.'alt'].''; if ($options['slide'.$i.'link']) { print ''; } else { print ''; } print '
  • '."\n"; } } } } /*-------------------------------------------*/ /* Print option /*-------------------------------------------*/ function bizVektorOptions($optionLabel) { $options = biz_vektor_get_theme_options(); if ($options[$optionLabel] !='' ) { // If !='' that 0 true return $options[$optionLabel]; } else { bizVektorOptions_default(); global $bizVektorOptions_default; return $bizVektorOptions_default[$optionLabel]; } } /*-------------------------------------------*/ /* Set option default /*-------------------------------------------*/ function bizVektorOptions_default() { global $bizVektorOptions_default; $bizVektorOptions_default = array( 'postLabelName' => 'Blog', 'infoLabelName' => 'Information', 'rssLabelName' => 'Blog entries', 'theme_style' => 'default', 'pr1_title' => __('Rich theme options item', 'biz-vektor'), 'pr1_description' => __('Not only this part, you can change from theme customizer and theme options screen various items.', 'biz-vektor'), 'pr2_title' => __('Various designs available', 'biz-vektor'), 'pr2_description' => __('BizVektor will allow you not only can change the color of the site, to switch to a different design.', 'biz-vektor'), 'pr3_title' => __('Optimized for business web site', 'biz-vektor'), 'pr3_description' => __('It features such as induction to the query and child page list template, a variety of functions essential to business.', 'biz-vektor'), ); } /*-------------------------------------------*/ /* Print theme_options js /*-------------------------------------------*/ add_action('admin_print_scripts-appearance_page_theme_options', 'admin_theme_options_plugins'); function admin_theme_options_plugins( $hook_suffix ) { wp_enqueue_media(); wp_register_script( 'biz_vektor-theme-options', get_template_directory_uri().'/inc/theme-options.js', array('jquery'), '20120902' ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'biz_vektor-theme-options' ); } /*-------------------------------------------*/ /* Change fonts /*-------------------------------------------*/ add_action( 'wp_head','biz_vektor_fontStyle'); function biz_vektor_fontStyle(){ $options = biz_vektor_get_theme_options(); $font_face_serif = _x('serif', 'Font select', 'biz-vektor'); $font_face_serif = apply_filters( 'font_face_serif_custom', $font_face_serif ); $font_face_sans_serif = _x('Meiryo,Osaka,sans-serif', 'Font select', 'biz-vektor'); $font_face_sans_serif = apply_filters( 'font_face_sans_serif_custom', $font_face_sans_serif ); if ($options['font_title'] == 'serif') { $font_title_face = $font_face_serif ; $font_title_weight = 'bold'; } else { $font_title_face = $font_face_sans_serif; $font_title_weight = 'lighter'; } if ($options['font_menu'] == 'serif') { $font_menu_face = $font_face_serif ; } else { $font_menu_face = $font_face_sans_serif; } ?> console.log('%s')"; printf($str, $hook_suffix); } } */