日志标签 ‘Mail To Commenter’

Warning: Use of undefined constant archives - assumed 'archives' (this will throw an Error in a future version of PHP) in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: Use of undefined constant page - assumed 'page' (this will throw an Error in a future version of PHP) in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: A non-numeric value encountered in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: A non-numeric value encountered in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32
class="post-1401 post type-post status-publish format-standard hentry category-grass-roots-webmaster tag-mail-to-commenter tag-wordpress tag-191 tag-164">

求助:Cordobo Green Park 2主题如何添加Mail to Commenter的自定义按钮的代码

2011年3月11日

前几天博客装了Cordobo Green Park 2 主题,这个主题确实不错,很清爽,但是却发现这个主题的代码好像跟以前用过的有些不同。

由于不太懂后台代码,很多想修改的地方都找不到该在什么地方修改。
之前一直用
Mail to commenter插件,但是在这个主题里,我竟然找不到Mail to Commenter的自定义按钮的代码应该添加的位置。

Mail to commenter插件的设置界面的说明是:

自定义按钮显示:

这部分用来设定mailtocommenter_button()函数的输出内容和格式。请在模板文件中插入<?php if(function_exists(‘mailtocommenter_button’)) mailtocommenter_button();?>代码用于生成按钮。

 

之前用的主题也曾经被我找到了合适的位置,可是,为什么现在用的这个Cordobo Green Park 2 主题就是找不到了,把代码放在了好多地方测试,都无功而返……

哪位达人帮忙给看看,这个代码应该加在哪个文件的什么地方?

话说,刚装上主题的时候,想插入备案信息,结果在footer.php里面找了好久都没有找到插入备案信息的地方,最后竟然是在functions.php(主题支持函数)中找到了页脚的版权信息,sigh!

主题地址:http://wordpress.org/extend/themes/cordobo-green-park-2

Warning: Use of undefined constant archives - assumed 'archives' (this will throw an Error in a future version of PHP) in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: Use of undefined constant page - assumed 'page' (this will throw an Error in a future version of PHP) in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: A non-numeric value encountered in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: A non-numeric value encountered in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32
class="post-1282 post type-post status-publish format-standard hentry category-grass-roots-webmaster tag-mail-to-commenter tag-wordpress tag-164 tag-302">

Mail To Commenter插件使用中的两个问题

2010年8月31日

Mail To Commenter插件在人在岱北博客已经用了好久好久了,但是由于SunQ本身就是一个圡人,并不懂后台,所以之前用的主题都是集成了Mail To Commenter插件的主题,我也就没有做过什么设置的工作,但是最近换了个主题,却发现主题并没有集成Mail To Commenter插件,最直接的问题是,没有回复按钮,让回复评论变得很累。

前一段时间一直都懒,也就没在意这件事情,昨天ryan同学在评论我的博文《可怜之人必有可恨之处》时,建议我加上回复评论按钮,这时我才想起来,这个按钮已经空缺了好久了……

如何加入回复评论的按钮

在Mail To commenter插件的设置界面,有这么一句说明:

自定义按钮显示:
这部分用来设定mailtocommenter_button()函数的输出内容和格式。请在模板文件中插入<?php if(function_exists(‘mailtocommenter_button’)) mailtocommenter_button();?>代码用于生成按钮。

也就是说,只要在想要的地方插入想要出现的地方,就可以在那个地方显示你所设置的回复按钮……

可是,应该在哪里插入这段代码呢?

研究了半天我现在所使用的这个GenkiTheme主题,感觉要么是在single.php中修改,要么是在comments.php中修改。虽然不懂php,英语也是弱智级别,但是简单的词语还是懂一些的。

眼对眼研究了好久,觉得还是应该在comments.php中添加这个代码……

在comments.php中发现了这么一段代码:

<?php foreach ($comments as $comment) : ?>

        <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
            <?php if (function_exists(‘avatar_display_comments’)){ avatar_display_comments(get_comment_author_email(),’48’,”); } ?>&nbsp;&nbsp;<strong><?php comment_author_link() ?></strong> | <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date(‘F jS, Y’) ?> <?php _e(‘at’);?> <?php comment_time() ?></a> <?php edit_comment_link(‘e’,”,”); ?>

我想,这应该是评论的上方所出现的评论者信息栏吧,因为我看到了ID、date、time这样的字眼,而且重要的是,如果我用管理员登录后,会在这些信息的后面显示“e”,以用于编辑评论,而最后面那句“<?php edit_comment_link(‘e’,”,”); ?>”不正是编辑评论链接的表述嘛……

这正是我想放上回复评论按钮的地方,于是把那句代码粘贴在这段代码之后,更新文件。到前台刷新了一下,果然,评论按钮出现了!

解决邮件无发件人的现象

由于真的不懂代码,为了让自己的修改更保险一下,用Google搜了一下,虽然没有找到准确的答案,但是却找到了之前发现的一个问题的解决办法。

一年多以前了,2009年6月,自从wordpress升级到2.8以后,Mail To Commenter插件所发送的邮件就出现了问题:发送的邮件没有发件人,虽然基本功能还是能实现的,但是却真的有碍观瞻,说不定还会被人当作成垃圾邮件了……

在一个叫做Derek’s Blog的wordpress上,我找到了问题的解决办法:(以下内容转自:Mail To Commenter的未知发件人问题

修改Mail To Commenter插件目录下的文件mailtocommenter_functions.php,路径为****/wp-content/plugins/mailtocommenter,找到function mailtocommenter_send_email此行,照着修改(我是CP的),然后测试成功,收工。

function mailtocommenter_send_email($to,$subject,$message){
	$hostname = get_option('home');
	preg_match("/^(http:\/\/)?([^\/]+)/i",$hostname, $matches);
	$blogname = get_option('blogname');
	$blognameO = $blogname;
	$blogname .= " <no-reply@";
	$blogname .= $matches[2];
	$blogname .= ">";

	$charset = get_option('blog_charset');
	$headers  = "From: $blognameO <no-reply@$matches[2]> \n" ;
	$headers .= "MIME-Version: 1.0\n";
	$headers .= "Content-Type: text/html;charset=\"$charset\"\n";
	$to = strtolower($to);
	return @wp_mail($to, $subject, $message, $headers);
}
果然,按照Derek的方法修改之后,现在回复的邮件已经显示发件人了……
“困扰”了一年多的问题在偶然中找到了解决办法,正所谓“无心插柳柳成荫”呀……

启示

对网站做一些简单的修改,并不一定非要懂后台,懂代码,仔细分析一下代码内容,必要时借助一下Google,小问题也是可以轻松解决的!

Warning: Use of undefined constant archives - assumed 'archives' (this will throw an Error in a future version of PHP) in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: Use of undefined constant page - assumed 'page' (this will throw an Error in a future version of PHP) in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: A non-numeric value encountered in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32

Warning: A non-numeric value encountered in /www/wwwroot/daibei.info/wp-content/themes/cordobo-green-park-2/archive.php on line 32
class="post-1064 post type-post status-publish format-standard hentry category-grass-roots-webmaster tag-mail-to-commenter tag-wordpress tag-164">

Mail To Commenter 插件出现问题

2009年6月20日

自从前几天WordPress升级到2.8之后,发现Mail To Commenter插件出现了一个小问题:

原来显示为“人在岱北 静心聆泉 wordpress@sun-q.cn”的发件人处,竟然是空白!

(原来的收件人显示正确)

原因可能出现在哪里?有没有人跟我遇到同样的情况呢?