设置信息

设置网站底部信息

页面底部广告或信息

页面上部广告或信息

页面顶部      "; else echo "页面顶部       "; if(get_option("ad_postion") =="left") echo "文字左边      "; else echo "文字左边       "; if(get_option("ad_postion") == "right") echo "文字右边      "; else echo "文字右边
"; ?>

设置关键字

设置网站描述

'; echo '
  • google
  • '; echo ''; } function testCB(){ add_meta_box('bunengba', 'upload', 'hello_custom_box', 'post', 'side', 'high'); } add_action('add_meta_boxes', 'testCB'); */ function display_up_ad_text( $content ) { $up_ad_text = get_option('up_ad_text'); if(empty($up_ad_text)) return $content; if( is_single() ) { $ad_postion = get_option("ad_postion"); if($ad_postion == "top") $content = get_option('up_ad_text').$content ; else if($ad_postion == "left") { $leftdiv ="
    "; $rightdiv="
    "; $content= $leftdiv.get_option('up_ad_text').$rightdiv.$content; } else if($ad_postion == "right") { $leftdiv ="
    "; $rightdiv="
    "; $content= $leftdiv.get_option('up_ad_text').$rightdiv.$content ; } } return $content; } function display_down_ad_text($content){ if(is_single()) $content = $content.get_option('down_ad_text'); return $content; } function display_footerinfo( ) { echo get_option("display_footerinfo_text"); } if (!function_exists('utf8Substr')) { function utf8Substr($str, $from, $len) { return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'. '((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s', '$1',$str); } } function setKeywordandDescription() { if (is_home()){ $keywords = get_option("web_keyword"); $description = get_option("web_description"); } elseif (is_single()){ $pageID = get_the_ID(); $postInfo = &get_post($pageID); if ($postInfo->post_excerpt) { $description = $postInfo->post_excerpt; } else { if(preg_match('/

    (.*)<\/p>/iU',trim(strip_tags($postInfo->post_content,"

    ")),$result)){ $post_content = $result['1']; } else { $post_content_r = explode("\n",trim(strip_tags($postInfo->post_content))); $post_content = $post_content_r['0']; } $description = utf8Substr($post_content,0,220); } $keywords = ""; $tags = wp_get_post_tags($postInfo->ID); foreach ($tags as $tag ) { $keywords = $keywords . $tag->name . ","; } } echo "\n"; echo "\n"; } add_filter( 'the_content', 'display_down_ad_text' ); add_filter( 'the_content','display_up_ad_text'); add_filter('wp_footer','display_footerinfo'); add_filter('wp_head','setKeywordandDescription',0); ?>