/*-------------------------------------------*/ /* Category list 'count insert to inner /*-------------------------------------------*/ /* Block to delete iframe tag from TinyMCE /*-------------------------------------------*/ /* Comment /*-------------------------------------------*/ /* Archive page link ( don't erase ) /*-------------------------------------------*/ /* Pasing /*-------------------------------------------*/ /* Comment out short code /*-------------------------------------------*/ /* ChildPageList widget /*-------------------------------------------*/ load_theme_textdomain('biz-vektor'); add_theme_support( 'automatic-feed-links' ); add_post_type_support( 'info', 'front-end-editor' ); function biz_vektor_body_next(){ $body_next = ''; $body_next = apply_filters( 'biz_vektor_body_next', $body_next ); echo $body_next; } /*-------------------------------------------*/ /* Set content width /* (Auto set up to media max with.) /*-------------------------------------------*/ if ( ! isset( $content_width ) ) $content_width = 640; /*-------------------------------------------*/ /* Custom menu /*-------------------------------------------*/ register_nav_menus( array( 'Header' => 'Header Navigation', ) ); register_nav_menus( array( 'FooterNavi' => 'Footer Navigation', ) ); register_nav_menus( array( 'FooterSiteMap' => 'Footer SiteMap', ) ); /*-------------------------------------------*/ /* Widget /*-------------------------------------------*/ function biz_vektor_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar(Front page only)', 'biz-vektor' ), 'id' => 'top-side-widget-area', 'description' => __( 'This widget area appears on the front page only.', 'biz-vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sidebar(Post content only)', 'biz-vektor' ), 'id' => 'post-widget-area', 'description' => __( 'This widget area appears only on the post content pages.', 'biz-vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sidebar(Page content only)', 'biz-vektor' ), 'id' => 'page-widget-area', 'description' => __( 'This widget area appears only on the page content pages.', 'biz-vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sidebar(Common top)', 'biz-vektor' ), 'id' => 'common-side-top-widget-area', 'description' => __( 'This widget area appears at top of sidebar.', 'biz-vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sidebar(Common bottom)', 'biz-vektor' ), 'id' => 'common-side-bottom-widget-area', 'description' => __( 'This widget area appears at bottom of sidebar.', 'biz-vektor' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'biz_vektor_widgets_init' ); /*-------------------------------------------*/ /* Custom header /*-------------------------------------------*/ // Use custom header text define( 'HEADER_TEXTCOLOR', '' ); // Kill custom header test 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_theme_support( 'custom-header' ); if ( ! function_exists( 'admin_header_style' ) ) : function admin_header_style() { } endif; /*-------------------------------------------*/ /* Custom background /*-------------------------------------------*/ function biz_vektor_setup(){ add_theme_support( 'custom-background', array( 'default-color' => 'fcfcfc', ) ); } add_action( 'after_setup_theme', 'biz_vektor_setup' ); /*-------------------------------------------*/ /* Load theme options /*-------------------------------------------*/ require( dirname( __FILE__ ) . '/inc/theme-options.php' ); /*-------------------------------------------*/ /* Load Setting of Default / Calmly /*-------------------------------------------*/ require( dirname( __FILE__ ) . '/bizvektor_themes/001/001_custom.php' ); require( dirname( __FILE__ ) . '/bizvektor_themes/002/002_custom.php' ); /*-------------------------------------------*/ /* Load Theme customizer /*-------------------------------------------*/ require( dirname( __FILE__ ) . '/inc/theme-customizer.php' ); /*-------------------------------------------*/ /* Admin admin_bar_custom /*-------------------------------------------*/ get_template_part('module_adminBarCustom'); /*-------------------------------------------*/ /* Admin page _ Add style /*-------------------------------------------*/ function bizVektor_admin_css(){ // echo ''; $adminCssPath = get_template_directory_uri().'/css/style_bizvektor_admin.css'; wp_enqueue_style( 'theme', $adminCssPath , false, '2014-04-29'); } add_action('admin_head', 'bizVektor_admin_css', 11); /*-------------------------------------------*/ /* Admin page _ Add post status to body class /*-------------------------------------------*/ function bizVektor_postStatus(){ $classes = get_post_status(); ?> '; echo ''; echo '

'.__('To distinguish between individual keywords, please enter a , delimiter (optional).', 'biz-vektor').'
'; $theme_option_seo_link = ''._x('','link to seo setting', 'biz-vektor').''; sprintf(__('* keywords common to the entire site can be set from %s.', 'biz-vektor'),$theme_option_seo_link); echo '

'; } function save_custom_field_metaKeyword($post_id){ $metaKeyword = isset($_POST['noncename_custom_field_metaKeyword']) ? htmlspecialchars($_POST['noncename_custom_field_metaKeyword']) : null; if(!wp_verify_nonce($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)); } } /*-------------------------------------------*/ /* Admin page _ page _ customize /*-------------------------------------------*/ add_post_type_support( 'page', 'excerpt' ); // add excerpt function remove_default_page_screen_metaboxes() { // remove_meta_box( 'postcustom','page','normal' ); // cutom field // remove_meta_box( 'postexcerpt','page','normal' ); // excerpt remove_meta_box( 'commentstatusdiv','page','normal' ); // discussion remove_meta_box( 'commentsdiv','page','normal' ); // comment remove_meta_box( 'trackbacksdiv','page','normal' ); // trackback // remove_meta_box( 'authordiv','page','normal' ); // author // remove_meta_box( 'slugdiv','page','normal' ); // slug // remove_meta_box( 'revisionsdiv','page','normal' ); // revision } add_action('admin_menu','remove_default_page_screen_metaboxes'); /*-------------------------------------------*/ /* Admin page _ post _ customize /*-------------------------------------------*/ function remove_default_post_screen_metaboxes() { // remove_meta_box( 'postcustom','post','normal' ); // cutom field // remove_meta_box( 'postexcerpt','post','normal' ); // excerpt // remove_meta_box( 'commentstatusdiv','post','normal' ); // comment // remove_meta_box( 'trackbacksdiv','post','normal' ); // trackback // remove_meta_box( 'slugdiv','post','normal' ); // slug // remove_meta_box( 'authordiv','post','normal' ); // author } add_action('admin_menu','remove_default_post_screen_metaboxes'); /*-------------------------------------------*/ /* head_description /*-------------------------------------------*/ function getHeadDescription() { global $wp_query; $post = $wp_query->get_queried_object(); if (is_home() || is_page('home') || is_front_page()) { if ( isset($post->post_excerpt) && $post->post_excerpt ) { $metadescription = $post->post_excerpt; } else { $metadescription = get_bloginfo( 'description' ); } } else if (is_category() || is_tax()) { $metadescription = $post->category_description; if ( ! $metadescription ) { $metadescription = sprintf(__('About %s', 'biz-vektor'),single_cat_title()).get_bloginfo('name').' '.get_bloginfo('description'); } } else if (is_tag()) { $metadescription = strip_tags(tag_description()); $metadescription = str_replace(array("\r\n","\r","\n"), '', $metadescription); // delete br if ( ! $metadescription ) { $metadescription = sprintf(__('About %s', 'biz-vektor'),single_tag_title()).get_bloginfo('name').' '.get_bloginfo('description'); } } else if (is_archive()) { if (is_year()){ $description_date = get_the_date( _x( 'Y', 'yearly archives date format', 'biz-vektor' ) ); $metadescription = sprintf(_x('Article of %s.','Yearly archive description', 'biz-vektor'), $description_date ); $metadescription .= ' '.get_bloginfo('name').' '.get_bloginfo('description'); } else if (is_month()){ $description_date = get_the_date( _x( 'F Y', 'monthly archives date format', 'biz-vektor' ) ); $metadescription = sprintf(_x('Article of %s.','Archive description', 'biz-vektor'),$description_date ); $metadescription .= ' '.get_bloginfo('name').' '.get_bloginfo('description'); } else if (is_author()) { $userObj = get_queried_object(); $metadescription = sprintf(_x('Article of %s.','Archive description', 'biz-vektor'),esc_html($userObj->display_name) ); $metadescription .= ' '.get_bloginfo('name').' '.get_bloginfo('description'); } else { $postType = get_post_type(); $metadescription = sprintf(_x('Article of %s.','Archive description', 'biz-vektor'),esc_html(get_post_type_object($postType)->labels->name) ); $metadescription .= ' '.get_bloginfo('name').' '.get_bloginfo('description'); } } else if (is_page() || is_single()) { $metaExcerpt = $post->post_excerpt; if ($metaExcerpt) { // $metadescription = strip_tags($post->post_excerpt); $metadescription = strip_tags($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); // delete br } } else { $metadescription = get_bloginfo('description'); } $metadescription = apply_filters( 'metadescriptionCustom', $metadescription ); echo $metadescription; } /*-------------------------------------------*/ /* head_wp_head clean and add items /*-------------------------------------------*/ // Remove WordPress information remove_action('wp_head', 'wp_generator'); // Remove prev,next // remove_action('wp_head','adjacent_posts_rel_link_wp_head',10); // Add Google Web Fonts add_action('wp_head','bizVektorAddWebFonts'); function bizVektorAddWebFonts(){ $webFonts = ''."\n"; $webFonts = apply_filters('webFontsCustom', $webFonts ); echo $webFonts; } // Add BizVektor option css add_action('wp_head','bizVektorAddCommonStyle'); function bizVektorAddCommonStyle(){ $optionStyle = ''."\n"; $optionStyle = apply_filters('optionStyleCustom', $optionStyle ); echo $optionStyle; } // add pingback add_action('wp_head','bizVektorAddPingback'); function bizVektorAddPingback(){ $pingback = ''."\n"; $pingback = apply_filters('pingbackCustom', $pingback ); echo $pingback; } /*-------------------------------------------*/ /* footer_wp_footer clean and add items /*-------------------------------------------*/ add_action('wp_head','bizVektorAddJsScripts'); function bizVektorAddJsScripts(){ wp_register_script( 'biz-vektor-min-js' , get_template_directory_uri().'/js/biz-vektor-min.js', array('jquery'), '20140519' ); wp_enqueue_script( 'biz-vektor-min-js' ); } function add_defer_to_bizVektor_js( $url ) { if ( FALSE === strpos( $url, 'biz-vektor/js' ) or FALSE === strpos( $url, '.js' ) ) { // not our file return $url; } // Must be a ', not "! return "$url' defer='defer"; } add_filter( 'clean_url', 'add_defer_to_bizVektor_js', 11, 1 ); /*-------------------------------------------*/ /* Term list no link /*-------------------------------------------*/ 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; } /*-------------------------------------------*/ /* Global navigation add cptions /*-------------------------------------------*/ class description_walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth=0, $args=array(),$id = 0) { 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'); /*-------------------------------------------*/ /* Category list 'count insert to inner /*-------------------------------------------*/ 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 ); /*-------------------------------------------*/ /* Block to delete iframe tag from TinyMCE /*-------------------------------------------*/ 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'); /*-------------------------------------------*/ /* 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' ) : ?>
    __('Reply', 'biz-vektor'), '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 /*-------------------------------------------*/ /* If there is a place that you want to hide temporarily in the text field, [ignore] When enclosing [/ ignore], can be commented out the relevant sections in the html mode. */ function ignore_shortcode( $atts, $content = null ) { return null; } add_shortcode('ignore', 'ignore_shortcode'); /*-------------------------------------------*/ /* ChildPageList widget /*-------------------------------------------*/ function biz_vektor_childPageList(){ global $post; if (is_page()) { if($post->ancestors){ foreach($post->ancestors as $post_anc_id){ $post_id = $post_anc_id; } } else { $post_id = $post->ID; } if ($post_id) { $children = wp_list_pages("title_li=&child_of=".$post_id."&echo=0"); if ($children) { ?>

    'WP_Widget_childPageList', 'description' => __('child Page lists', 'biz-vektor') ); $this->WP_Widget('childPageList', __('child page list of pages', 'biz-vektor'), $widget_ops); } /** @see WP_Widget::widget */ function widget($args, $instance) { extract( $args ); if(biz_vektor_childPageList()){ echo $before_widget; biz_vektor_childPageList(); echo $after_widget; } } // /** @see WP_Widget::update */ // function update($new_instance, $old_instance) { // return $new_instance; // } // /** @see WP_Widget::form */ // function form($instance) { // $title = esc_attr($instance['title']); // } } // class WP_Widget_childPageList // register WP_Widget_childPageList widget add_action('widgets_init', create_function('', 'return register_widget("WP_Widget_childPageList");'));