msgbartop
better late than never
msgbarbottom

Aug 15 插件 miniposts

早就想加一个微博一样的功能了,有时候没啥么话,写一篇日记纯属浪费么。搜了一下,看到了一个Miniposts插件,不过网上说的安装步骤很潦草,用到了小工具,因为我用到的插件有一部分是不支持小工具的,所以没用它。只能自己来了。大概看了下代码,稍微改了下,以符合我的博客风格。

大概说下我的步骤吧。

安装,启用不必多说。

1、设置-Miniposts。

Filtering里有三项,第一个是博客列表里隐藏微博,第二个是feeds里隐藏微博,用默认选项就可以了。第三个显示多少条,看着来吧。

Widget title 就是标题了,比如我的MiniPosts。

Minipost appearance 默认的格式,完全不符合我的要求,所以改了下:

<li>%post%%more% (%commentcount%)</li>

More appearance,这个,有点鸡肋的感觉,就是在每条微博后显示个更多(more嘛,当然文字可以设)链接到文章页。有两种方式,一种是写摘要,这样微博上显示的是摘要,额,这不还搞得跟博客一样么。还有一种在写博客时加<!–more–>,看了下代码,显示的时候,是有把<!–more–>转换成链接的步骤,但是,文章保存的时候,会把<>转换成实体字符的,所以这个没啥用。

然后保存。

2、开始改代码。

先是plugins/miniposts/miniposts.php ,大概在183行找到

echo '<div class="miniposts">';

我博客的侧边栏都是用的都是ul li,

所以改成

 echo '<div class="miniposts"><h3>'.htmlspecialchars(get_option("miniposts_title")).'</h3><ul>';

li在第一步的设置里已经改好了。

224行改成

echo '</ul></div>';

然后是themes/googlechrome/sidebar.php,

googlechrome主题下侧边栏的每一个模块都是由类似下面的代码组成的:

	<div class='sidebarboxtop'><img src="<?php bloginfo('template_url') ?>/images/sidebartop.gif" alt="sidebartop" /></div>

        <div class='sidebarbox'>

		<?php get_mini_posts(); ?> //这里显示的就是上面echo的部分了

        </div>

        <div class='sidebarboxbottom'><img src="<?php bloginfo('template_url') ?>/images/sidebarbottom.gif" alt="sidebarbottom" /></div>

在合适的位置加上上面的代码,就可以在侧边栏看到我博客的Miniposts这个样子了。

额,还差最后一步,发表。

就跟普通发表文章一样,只不过右下方有个This is a mini post,记得勾上就可以了。不过我的配置里,标题是不显示的,忽忽~不过点评论数可以进入文章页,算是个小小的入口吧。

结束了,看一下,好像也没做啥么事,花费的时间可不少。



Reader's Comments

  1. |

    我也想装WP了… :jiayou:

    [回复]

    南晓晓 回复:

    @koyoz, 好丑的多层回复

    [回复]

  2. |

    @koyoz :ding:

    [回复]



Leave a Comment




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word