Skip to:
Content
Pages
Categories
Search
Top
Bottom

Date shown in Default BP theme


  • podictionary
    Participant

    @podictionary

    I have a child BP theme built as instructed. I see that blog posts on the default BP theme show time of day but not date. I looked in WP Appearance > Editor and was able to change this for single posts by replacing the_time() with the_date() but I can’t find where I would do that to have all posts appearing on the blog behave the same way.

Viewing 13 replies - 1 through 13 (of 13 total)
  • I have the same question and came here hoping someone had answered it. I’ll keep poking and post here if I figure anything out.


    r-a-y
    Keymaster

    @r-a-y

    Try editing /single.php and /page.php in your child theme.

    Edit the_time()’s parameters to add the date:
    https://codex.wordpress.org/Function_Reference/the_time


    Chris O’Brien
    Participant

    @sjcobrien

    Thanks @r-a-y . That worked for me on the individual blog posts. How do I get the change to also appear on the homepage? That is, when people are on the homepage, they still see the old time-only format. When they click on the post, the time and date appear on the post page.


    r-a-y
    Keymaster

    @r-a-y

    If you’re talking about activity updates, you’ll need to apply a filter to “bp_activity_time_since” (located in bp-activity/bp-activity-templatetags.php).

    Something like this in your theme’s functions.php:

    function my_bp_activity_time_since($relative_time, $activity) {
    // use date parameters – http://php.net/manual/en/function.date.php
    return date(‘FORMAT YOUR TIME’, $activity->date_recorded );
    }
    add_filter( ‘bp_activity_time_since’, ‘my_bp_activity_time_since’, 1, 2 );


    Chris O’Brien
    Participant

    @sjcobrien

    I’m not sure it’s the activity updates. See the homepage here: http://nextnewsroom.com. The time at the top of each posts just shows the time, not the date. If you click on the title of post, it displays time and date. Wondering why that change wouldn’t appear on the homepage as well as on the invidividual post?


    r-a-y
    Keymaster

    @r-a-y

    Oh that, you’ll need to modify index.php and do the same thing mentioned three posts above.


    Chris O’Brien
    Participant

    @sjcobrien

    @r-a-y Thanks. Do you mean I need to do the same thing I did to /pages and /posts? I did make the change in posts, but not pages. I didn’t see any reference to time in on pages.php or index.php. Any suggestion where I put it?


    r-a-y
    Keymaster

    @r-a-y

    Copy over /bp-themes/bp-default/index.php to your child theme and do the same thing I mentioned here:

    There is a reference to the_time(), so I’m not sure what you’re talking about.


    Pisanojm
    Participant

    @pisanojm

    Hey @r-a-y I ran into this today as well… This fix is as you said in the files you said.

    Simply delete the existing line and add this line to the files in question:

    -?php the_time(‘F j, Y’); ?- at -?php the_time(‘g:i a’); ?-
    Change – (minus signs) to PHP angled brackets.

    Seems like this should be in the default-theme from the get-go… maybe a ticket?

    I have to admit I’m still confused–there is no the_time() reference in index.php, nor is there any obvious place that I can see where you would insert such a date command. I just want the date of a blog post to appear on the main page, as it would in an ordinary WordPress blog installation, but it’s unclear to me where one would do so.


    r-a-y
    Keymaster

    @r-a-y

    @newrambler – for /index.php, it’s on line 26:
    https://trac.buddypress.org/browser/tags/1.2.5.2/bp-themes/bp-default/index.php

    @pisanojm – maybe a filter on the_time() would suffice, some might like the existing relative time. Definitely create an enhancement ticket!


    Pisanojm
    Participant

    @pisanojm

    @newrambler this is in the index.php of the buddypress theme… you have to go into the buddypress plugin –> then theme….


    Pisanojm
    Participant

    @pisanojm

    Ok, New ticket is here:
    https://trac.buddypress.org/ticket/2601

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Date shown in Default BP theme’ is closed to new replies.
Skip to toolbar