简体   繁体   English

BuddyPress组创建日期

[英]BuddyPress Group creation date

I want to display the creation date of a group with the date format j. FY 我想用日期格式j. FY显示组的创建日期j. FY j. FY

For that, I tried the function bp_group_date_created() . 为此,我尝试了bp_group_date_created()函数。 Unfortunately I get the wrong format (10 days ago). 不幸的是,我的格式错误(10天前)。 The function also didn't accept any other format. 该函数也不接受任何其他格式。

Does anyone have an idea? 有人有主意吗?

I found a soultion: 我发现了一个灵魂:

Copied the original function in the functions.php and changed it like this: 将原始功能复制到functions.php中,并进行如下更改:

function bp_get_group_date_created_ch( $group = false ) {
    global $groups_template;

    if ( empty( $group ) )
        $group =& $groups_template->group;

    return apply_filters( 'bp_get_group_date_created', strtotime( $group->date_created ) );
}

In the template I used this: 在模板中,我使用了以下命令:

<?php $timestamp=bp_get_group_date_created_ch(); echo gmdate("j.m.Y", $timestamp); ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM