Posts tagged ‘wordpress’

Warning: mb_strimwidth() [function.mb-strimwidth]

Warning: mb_strimwidth() [function.mb-strimwidth]: Start position is out of range in ../header.php

后来在作者的网站上找到了解决方案
打开header.php 第14行找到
mb_strimwidth(strip_tags(apply_filters(‘the_content’,$post->post_content)),6,220);
替换为substr(strip_tags($post->post_content),0,220);
就不提示这个信息了。

WordPress插件Auto-HighSlide

Auto-HighSlide是一款非常优秀的WordPress插件。该插件可以让文章图片在鼠标点击的时候出现放大和缩小图片的效果。许多独立博客都使用了这款插件。毫无疑问,此插件可以算是必备插件之一。

优点很明显:1.轻量级,加载快,不过分占用主机资源;2.无须任何设置,安装即可使用,非常方便;3.防止访客点击图片后跳出文章页面,增加访客页面停留时间,有利于SEO优化!

Continue reading ‘WordPress插件Auto-HighSlide’ »

WordPress页面函数:wp_list_pages()

模板标签wp_list_pages( )将WordPress页面作为链接显示出来。该模板标签常用于自定义侧边栏或标题,也常用于其他模板中。该模板标签在WordPress 1.5及更新版本中可用。
用法:

<?php wp_list_pages('arguments'); ?> 

默认参数设置为:

$defaults = array(
‘depth’ => 0, 显示所有页面和子页面(无深度限制)
‘show_date’ => ”, 不显示创建日期
‘date_format’ => get_option(‘date_format’),
‘child_of’ => 0, 子页面无限制
‘exclude’ => ”, 不删除任何页面
‘title_li’ => __(‘Pages’), 页面列表的标题为“Pages(页面)”
‘echo’ => 1, 回显(显示)结果
‘authors’ => ”, 不局限于特定作者
‘sort_column’ => ‘menu_order, post_title’, 先按页面顺序再按页面标题排序
‘link_before’ => ”,
‘link_after’ => ”,
‘exclude_tree’=> ” );不删除父级/子级树

WordPress利用wp_list_pages显示页面目录

这几天玩博客发现wordpress自带的导航栏对子页面的显示很不友好,默认是所有子页面都在导航栏显示。但是我想让子页面以下拉条式的样子显示。

在网上找了很多方法,有的多把日志分类放在导航条上就行了,但是日志一般会写很多,放在导航栏很不妥。

有人推荐用插件,像我这种最不喜欢依赖插件的人当然是选择能用代码就用代码解决了。虽然不美观,但是没有累赘。

于是我找了一个折中的办法,导航栏上不显示子页面,在所有主页面、子页面里显示页面树。

主页面会显示全部目录,子页面只显示子目录和父页面地址。

具体效果请见本博客的photos一栏。

Continue reading ‘WordPress利用wp_list_pages显示页面目录’ »

WordPress文章自动添加版权信息

一直以来没有设置自动版权信息,老是在文章结尾的时候标注一下。最近时间紧迫发现了,自动版权信息的作用。于是我无意中看到了“潘晓的博客”,感觉文字框还不错,就用Chrome查看其CSS样式,结合Wordpress简单的函数得到了我现在的版权信息:

具体步骤如下:

打开后台编辑,选择Single.php 找到 <?php the_content(__(‘Read more’, ‘piano-black’)); ?>

在其下方加入如下代码(提醒确保CSS中的样式名无重复,重复的话就去修改一下名字

<!-- 版权 Button BEGIN -->
<div style="border:1px dashed #ddd; padding:10px; margin:10px 0;line-height:26px;border-radius: 3px;"><div>
 » <b>本文链接:</b><a rel="bookmark" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">
<?php echo wp_get_shortlink(); ?></a></div><div> » <b>订阅本站:</b>
<a title="Jonee's Blog" href="http://jonee.net/feed" rel="external nofollow">jonee.net/feed</a></div>
<div> » <b>转载请注明来源:</b><a title="Jonee's Blog" href="http://jonee.net" rel="external nofollow">Jonee's Blog</a>
 » <a rel="bookmark" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">《<?php the_title(); ?>》</a></div>
</div>
<!-- 版权 Button BEGIN -->

OK,现在刷新一下你的文章,就会看到这个喽!

原创于Quicl’sBlog ,转载注明出处http://20xue.com/?p=1864