Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 修改Wordpress注释日期输出_Php_Wordpress_Comments - Fatal编程技术网

Php 修改Wordpress注释日期输出

Php 修改Wordpress注释日期输出,php,wordpress,comments,Php,Wordpress,Comments,我使用默认的WordPress评论系统,在我的评论模板中,我使用 <?php wp_list_comments() ?> 要生成评论,我想知道如何修改评论日期?目前,它显示的完整日期为2014年2月11日上午6:27。在查看了之后,我似乎无法通过wp\u list\u注释args修改日期格式 如何修改日期格式输出?在“注释”下的函数中找到以下内容: sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(

我使用默认的WordPress评论系统,在我的评论模板中,我使用

<?php wp_list_comments() ?> 

要生成评论,我想知道如何修改评论日期?目前,它显示的完整日期为2014年2月11日上午6:27。在查看了之后,我似乎无法通过
wp\u list\u注释
args修改日期格式


如何修改日期格式输出?

在“注释”下的函数中找到以下内容:

sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )

然后删除%2$s并获取以下内容的注释时间()

sprintf( __( '%1$s', 'twentytwelve' ), get_comment_date() )

如果要修改日期,请再次使用以下参考:

用法: 获取注释日期('D,F j')


我希望这是您喜欢的内容。

在“注释”下的函数中找到以下内容:

sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )

然后删除%2$s并获取以下内容的注释时间()

sprintf( __( '%1$s', 'twentytwelve' ), get_comment_date() )

如果要修改日期,请再次使用以下参考:

用法: 获取注释日期('D,F j')


我希望这是您喜欢的内容。

在“注释”下的函数中找到以下内容:

sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )

然后删除%2$s并获取以下内容的注释时间()

sprintf( __( '%1$s', 'twentytwelve' ), get_comment_date() )

如果要修改日期,请再次使用以下参考:

用法: 获取注释日期('D,F j')


我希望这是您喜欢的内容。

在“注释”下的函数中找到以下内容:

sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )

然后删除%2$s并获取以下内容的注释时间()

sprintf( __( '%1$s', 'twentytwelve' ), get_comment_date() )

如果要修改日期,请再次使用以下参考:

用法: 获取注释日期('D,F j')

我希望这是您喜欢的东西。

您有两个选择: 1.您可以尝试修改wordpress核心文件wp includes/comment-template.php。修改您想要的日期格式(这似乎更容易,但我不建议您修改核心文件) 2.您可以创建自定义回调函数以显示注释,如下所示: 你可以调用这个函数

现在,您可以在function.php文件中创建自定义函数my_custom_comment,它将用自定义列表格式替换默认列表

现在在function.php中创建一个名为my_custom_comment的函数,并修改日期格式

有关wp_列表_评论的更多详细信息,请参阅)

函数我的自定义注释($comment,$args,$depth){
$GLOBALS['comment']=$comment;
提取($args,EXTR_SKIP);
如果('div'=$args['style'])){
$tag='div';
$add_below='comment';
}否则{
$tag='li';
$add_below='div comment';
}
?>
id=“comment-”>
您有两个选择:
1.您可以尝试修改wordpress核心文件wp includes/comment-template.php。修改您想要的日期格式(这似乎更容易,但我不建议您修改核心文件)
2.您可以创建一个自定义回调函数来显示您的注释,如下所示:
你可以调用这个函数

现在,您可以在function.php文件中创建自定义函数my_custom_comment,它将用自定义列表格式替换默认列表

现在在function.php中创建一个名为my_custom_comment的函数,并修改日期格式

有关wp_列表_评论的更多详细信息,请参阅)

函数我的自定义注释($comment,$args,$depth){
$GLOBALS['comment']=$comment;
提取($args,EXTR_SKIP);
如果('div'=$args['style'])){
$tag='div';
$add_below='comment';
}否则{
$tag='li';
$add_below='div comment';
}
?>
id=“comment-”>
您有两个选择:
1.您可以尝试修改wordpress核心文件wp includes/comment-template.php。修改您想要的日期格式(这似乎更容易,但我不建议您修改核心文件)
2.您可以创建一个自定义回调函数来显示您的注释,如下所示:
你可以调用这个函数

现在,您可以在function.php文件中创建自定义函数my_custom_comment,它将用自定义列表格式替换默认列表

现在在function.php中创建一个名为my_custom_comment的函数,并修改日期格式

有关wp_列表_评论的更多详细信息,请参阅)

函数我的自定义注释($comment,$args,$depth){
$GLOBALS['comment']=$comment;
提取($args,EXTR_SKIP);
如果('div'=$args['style'])){
$tag='div';
$add_below='comment';
}否则{
$tag='li';
$add_below='div comment';
}
?>
id=“comment-”>
您有两个选择:
1.您可以尝试修改wordpress核心文件wp includes/comment-template.php。修改您想要的日期格式(这似乎更容易,但我不建议您修改核心文件)
2.您可以创建一个自定义回调函数来显示您的注释,如下所示:
你可以调用这个函数

现在,您可以在function.php文件中创建自定义函数my_custom_comment,它将用自定义列表格式替换默认列表

现在在function.php中创建一个名为my_custom_comment的函数,并修改日期格式

有关wp_列表_评论的更多详细信息,请参阅)

函数我的自定义注释($comment,$args,$depth){
$GLOBALS['comment']=$comment;
提取($args,EXTR_SKIP);
如果('div'=$args['style'])){
$tag='div';
$add_below='comment';
}否则{
$tag='li';
$add_below='div comment';
}
?>
id=“comment-”>

使用WordPress编解码器文档,您可以添加一个回调函数作为
wp\u list\u comments
的参数

<?php
    wp_list_comments( array(
        'style'       => 'ul',
        'callback'  =>  'custom_comment_template'
    ));
?>

从wp includes/class-walker-comment.php复制评论模板。并修改此部分以满足您的需要。您可以在此处使用for WordPress

 function custom_comment_template(){
 // Codes you have copies from wp-includes/class-walker-comment.php
 // Or any design you want to use. You can use the hooks and filters
 // from wp-includes/comment-template.php like 
    get_comment_author_link, get_comment_author

 <div class="comment-meta commentmetadata">
  <a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
    <?php
     /* translators: 1: Comment date, 2: Comment time. */
     printf( __( '%1$s at %2$s' ), get_comment_date( '', $comment ), get_comment_time() );
            ?>
  </a>
  <?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' ); ?>
 </div>
 }
函数自定义注释模板(){
//从wp includes/class-walker-comment.php复制的代码
//或者任何你想使用的设计。你可以使用钩子和过滤器
//来自wp includes/comment-template.php lik