/*-------------------------------------------*/
/* 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' => '
'.__('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 = '
Pingback: (', ')' ); ?>
max_num_pages > 1 ) : ?>
← Older post', 'biz-vektor')); ?>
→', 'biz-vektor')); ?>
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");'));