<?php
//公告
include("includes/custom-post-types.php");
//登陆显示头像
function qintag_get_avatar($email, $size = 48){
return get_avatar($email, $size);
}
add_action('admin_head', 'my_custom_logo');
function my_custom_logo() {
echo '
<!--
#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/custom-logo.png) !important; }
-->
';
}
//禁用半角符号自动转换为全角
remove_filter('the_content', 'wptexturize');
//移除管理员工具条(或:后台也有设置项)
//remove_action('init', '_wp_admin_bar_init');
//comments link redirect WordPress评论留言链接优化-加nofollow和url重定向跳转
add_filter('get_comment_author_link', 'add_redirect_comment_link', 5);
add_filter('comment_text', 'add_redirect_comment_link', 99);
function add_redirect_comment_link($text = ''){
$text=str_replace('href="', 'href="'.get_option('home').'/?r=', $text);
$text=str_replace("href='", "href='".get_option('home')."/?r=", $text);
return $text;
}
add_action('init', 'redirect_comment_link');
function redirect_comment_link(){
$redirect = $_GET['r'];
if($redirect){
if(strpos($_SERVER['HTTP_REFERER'],get_option('home')) !== false){
header("Location: $redirect");
exit;
}
else {
header("Location: http://www.voyonix.com/");
exit;
}
}
}
//阻止 WordPress 对站内文章的 pingback http://wange.im/no-self-ping-in-wordpress.html
function no_self_ping( &$links ) {
$home = get_option( 'home' );
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, $home ) )
unset($links[$l]);
}
add_action( 'pre_ping', 'no_self_ping' );
/////////////////// 404 ///////////////////////////////////////////////
function wcs_error_currentPageURL()
{
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80")
{
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
}
else
{
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
}
return $pageURL;
}
class wcs_error_Walker_PageDropdownEx extends Walker
{
// returns options list with pages; option value is URL (not page ID)
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
function start_el(&$output, $page, $depth, $args)
{
$pad = str_repeat(' ', $depth * 3);
$output .= "\t<option class=\"level-$depth\" value=\"" . get_permalink($page->ID) . "\"";
if ($page->ID == $args['selected'])
{
$output .= ' selected="selected"';
}
$output .= '>';
$title = esc_html($page->post_title);
$output .= "$pad$title";
$output .= "</option>\n";
}
}
function wcs_error_pulldown_pages()
{
// init
$walker = new wcs_error_Walker_PageDropdownEx();
$args = array();
$args['echo'] = '0';
$args['walker'] = $walker;
// build the pulldown menu
$options_html = "\t<option>(select a page)</option>";
$options_html .= wp_list_pages($args);
$select_html = '<select name="page_url" onChange="document.location.href=this.options[this.selectedIndex].value;">';
$select_html .= $options_html . '</select>';
// exit
return $select_html;
}
function wcs_error_pulldown_archives()
{
// build the pulldown menu
$options_html = "\t<option>(select a month)</option>";
$args['echo'] = '0';
$args['format'] = 'option';
$args['type'] = 'monthly';
$args['show_post_count'] = 'true';
$wp_post_count = wp_count_posts();
if ($wp_post_count->publish <= 1)
{
$select_html = '(none)';
}
else
{
$options_html .= wp_get_archives($args);
$select_html = '<select name="archive_url" onChange="document.location.href=this.options[this.selectedIndex].value;">';
$select_html .= $options_html . '</select>';
}
// exit
return $select_html;
}
function wcs_error_pulldown_categories()
{
// build the pulldown menu
$options_html = "\t<option>(select a topic)</option>";
$args['echo'] = '0';
$args['show_count'] = '1';
$args['hierarchical'] = '1';
$wp_post_count = wp_count_posts();
if ($wp_post_count->publish <= 1)
{
$select_html = '(none)';
}
else
{
$options_html .= wp_dropdown_categories($args);
$options_html = str_replace("<select name='cat' id='cat' class='postform' >", '', $options_html);
$options_html = str_replace('</select>', '', $options_html);
$select_html = '<form method="get" action="' . get_bloginfo('url') . '">';
$select_html .= '<select name="cat" id="cat" onChange="this.form.submit()">';
$select_html .= $options_html . '</select></form>';
}
// exit
return $select_html;
}
// -------- END -------------------------------------------------------
//////////////////////////////标题文字截断//////////////////////////////
function cut_str($src_str,$cut_length) {
$return_str='';
$i=0;
$n=0;
$str_length=strlen($src_str);
while (($n<$cut_length) && ($i<=$str_length)) {
$tmp_str=substr($src_str,$i,1);
$ascnum=ord($tmp_str);
if ($ascnum>=224) {
$return_str=$return_str.substr($src_str,$i,3);
$i=$i+3;
$n=$n+2;
}
elseif ($ascnum>=192) {
$return_str=$return_str.substr($src_str,$i,2);
$i=$i+2;
$n=$n+2;
}
elseif ($ascnum>=65 && $ascnum<=90) {
$return_str=$return_str.substr($src_str,$i,1);
$i=$i+1;
$n=$n+2;
}
else {
$return_str=$return_str.substr($src_str,$i,1);
$i=$i+1;
$n=$n+1;
}
}
if ($i<$str_length) {
$return_str = $return_str . '';
}
if (get_post_status() == 'private') {
$return_str = $return_str . '(private)';
}
return $return_str;
}
// -------- END -------------------------------------------------------
//////////////////////////////版权年份自动化//////////////////////////////
function comicpress_copyright() {
global $wpdb;
$copyright_dates = $wpdb->get_results("
SELECT
YEAR(min(post_date_gmt)) AS firstdate,
YEAR(max(post_date_gmt)) AS lastdate
FROM
$wpdb->posts
WHERE
post_status = 'publish'");
$output = '';
if($copyright_dates) {
$copyright = "© " . $copyright_dates[0]->firstdate;
if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
$copyright .= '-' . $copyright_dates[0]->lastdate;
}
$output = $copyright;
}
return $output;
}
// -------- END -------------------------------------------------------
//////////////////////////////图片暗箱自动添加标签属性/////////////////
add_filter('the_content', 'pirobox_gall_replace');
function pirobox_gall_replace ($content) {
global $post;
$pattern = "/<a(.*?)href=('|\")([^>]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i";
$replacement = '<a$1href=$2$3.$4$5 class="pirobox_gall"$6>$7</a>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
// -------- END -------------------------------------------------------
//////////////////////////////支持外链缩略图///////////////////////////
function get_featcat_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$random = mt_rand(1, 10);
echo get_bloginfo ( 'stylesheet_directory' );
echo '/images/random/'.$random.'.jpg';
没有合适的资源?快使用搜索试试~ 我知道了~
wordpress国人胖子马的免费经典主题
共117个文件
png:39个
php:38个
jpg:12个
需积分: 19 14 下载量 111 浏览量
2012-06-30
10:52:54
上传
评论
收藏 859KB ZIP 举报
温馨提示
国内牛人胖子马的wordpress博客主题,可以自定义4种颜色,后台可以做多种调整,推荐
资源推荐
资源详情
资源评论
收起资源包目录
wordpress国人胖子马的免费经典主题 (117个子文件)
style.css 54KB
blue_style.css 52KB
purple_style.css 52KB
green_style.css 52KB
black_style.css 52KB
functions.css 3KB
oops_sorry_ani.gif 43KB
ajax-loader.gif 2KB
bulletin.gif 736B
new.gif 308B
ynext.gif 60B
hover.htc 4KB
favicon.ico 9KB
screenshot.jpg 96KB
6.jpg 36KB
ad.jpg 33KB
2.jpg 33KB
7.jpg 31KB
3.jpg 28KB
4.jpg 27KB
10.jpg 25KB
5.jpg 25KB
9.jpg 23KB
8.jpg 23KB
1.jpg 20KB
jquery-1.7.1.min.js 92KB
pirobox.min.js 19KB
comments-ajax.js 6KB
jquery.pzima.js 5KB
rm_script.js 738B
functions.php 62KB
single-bulletin.php 10KB
book.php 9KB
taxonomy-genre.php 8KB
comments.php 7KB
comments-ajax.php 7KB
header.php 5KB
sidebar.php 4KB
smiley.php 4KB
breadcrumbs.php 3KB
404.php 3KB
footer.php 3KB
seo.php 3KB
index.php 3KB
single.php 3KB
custom-post-types.php 2KB
topnv_extend.php 2KB
archive.php 2KB
search.php 2KB
related.php 2KB
social.php 2KB
template-guestbook.php 2KB
template-site-search.php 1KB
site-search.php 1KB
template-archives.php 1KB
sidebar_tab2.php 1KB
template-onecolumn.php 1KB
sidebar_tab.php 1KB
page.php 980B
sponsor.php 962B
template-miniblog.php 791B
template-categories.php 772B
template-tags.php 696B
template-links.php 689B
thumbnail.php 534B
bulletin.php 433B
searchform.php 353B
paginate.php 125B
all_icon.png 83KB
top_ad.png 32KB
error_t-shirt_purple.png 11KB
gravatar.png 6KB
quote.png 4KB
topnv_logo.png 3KB
code.png 3KB
heart_16.png 3KB
top_shadow.png 3KB
lightbulb_16.png 3KB
rss.png 3KB
pre.png 3KB
info_button_16.png 3KB
top_title.png 3KB
top_button1.png 3KB
top_button.png 3KB
close_btn_h.png 2KB
prev_h.png 1KB
next_h.png 1KB
close_btn.png 1KB
next.png 1KB
prev.png 1KB
b_l.png 1KB
t_r.png 1KB
b_r.png 1KB
t_l.png 1KB
pointer.png 1KB
link_out_h.png 1008B
link_out.png 1008B
c_r.png 984B
c_l.png 984B
b_c.png 984B
共 117 条
- 1
- 2
资源评论
chenps10
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功