如何在注释表单数组中回显当前帖子标题?

时间:2015-02-24 17:12:45

标签: php arrays wordpress comments title

我有这段代码:

        comment_form( 
        array(
            'fields'                => $fields, 
            'comment_field'         => $comment_field, 
            'label_submit'          => 'Plaatsen', 
            'comment_notes_before'  => '', 
            'comment_notes_after'   => '', 
            'title_reply'           => 'Wat is jouw ervaring met'
        )
    ); 

我想回复一下title_reply数组背后的当前帖子标题,如下所示:

'title_reply'           => 'Wat is jouw ervaring met <?php echo get_the_title( $ID ); ?> ? '

任何人都可以帮我正确地做到这一点吗?

2 个答案:

答案 0 :(得分:0)

尝试使用以下代码

$comment_form = array( 
    'fields' => $fields, 
    'comment_field' => $comment_field, 
    'label_submit' => 'Plaatsen', 
    'comment_notes_before' => '', 
    'comment_notes_after' => '', 
    'title_reply' => 'Wat is jouw ervaring met'
     );

`echo $comment_form['title_reply']; `

答案 1 :(得分:0)

'title_reply' => 'Wat is jouw ervaring met ' . get_the_title($ID)