欲思(yusi)主题个人感觉使用起来还是很不错的,但是另外呢本人在使用过程中发现还是有些瑕疵的,本文就给大家介绍如何优化幻灯片以及修正百度分享按钮显示错乱!
修正幻灯片(优化之自动截取尺寸)
第一步:在主题文件夹里functions.php
加入下面这个读取图片地址
/*** ** *幻灯片优化代码 */ function get_post_thumbnail_url($thumbnail = 'thumbnail', $post_id = ''){ global $post; $post_id = (null === $post_id) ? get_the_ID() : $post_id; $thumbnail_id = get_post_thumbnail_id($post -> ID); $thumb_src = ''; if($thumbnail_id){ $thumb = wp_get_attachment_image_src($thumbnail_id, $thumbnail); $thumb_src = $thumb[0]; if ($thumbnail != 'full' && empty($thumb_src)){ $thumb = wp_get_attachment_image_src($thumbnail_id, 'full'); $thumb_src = $thumb[0]; } } if (empty($thumb_src)){ $thumb_src = preg_match_all('/<img.*?src=['"](.*?)['"]/is', $post -> post_content, $matches) ? $matches[1][0]:''; } if (!empty($thumb_src)){ return $thumb_src; }else{ $random = mt_rand(1, 10); return get_bloginfo('template_url') . '/img/pic/' . $random . '.jpg'; } }
第二步:把modules/sticky.php
这个文件的代码替换为下面这代码:
最后一步:现在大图也是自动使用timthumb.php
截取716*279的图片大小。
需要在timthumb.php
这里添加你连接图片网址的域名。
$ALLOWED_SITES = array ('jszbug.com',0513c.com');
另外,使用这个timthumb功能,还要设置主题文件夹cache权限777就能正常使用了.
注:裁剪后幻灯片图显示的可能会不完整!
二、开户百度分享后,百度分享在IE浏览器下会显示错乱的问题
在主题文件夹js/jquery.js
文件里找到share.css'}],};
接着在share.css'}],};
后面加入:
with(document)0[(getElementsByTagName("head")[0]||body).appendChild(createElement("script")).src="http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion="+~(-new Date()/36e5)];
同时在footer.php
文件里删除这段:
global $dHasShare; if($dHasShare == true){ echo''; }