如何以几种不同的方式更改备注表单?

时间:2016-11-06 作者:Claude

I already altered my comments form by replacing<?php comment_form(); ?>with<?php comment_form(array(\'title_reply\'=>\'Leave a comment\')); ?>so that I could change the tile of the comment area.

Now I want to change the note above the box where guests type their comments. I saw on this site that I can do so by changing<?php comment_form(); ?>to<?php comment_form(array(\'comment_notes_before\' => ‘MY MODIFIED TEXT HERE.’)); ?>

The problem is, I already changed that bit of code (<?php comment_form(); ?>) for my first modification, so it\'s no longer there. What do I need to do to have both modifications? I\'ve tried different things but no solution yet. I\'m new at this, obviously.

Thanks in advance.

1 个回复
SO网友:fuxia

参数是一个数组,因此可以使用多个键值对,如下所示:

comment_form(
    [
        \'title_reply\'          => \'Leave a comment\',
        \'comment_notes_before\' => \'some text\',
    ]
);
在第二个示例中,您使用了卷引号。这些不是有效的PHP。确保您拥有debug enabled 在开发过程中,您可以在将这些错误推送到实时站点之前查看这些错误。