Skip to:
Content
Pages
Categories
Search
Top
Bottom

Freshness Link


  • CC-Cailin
    Participant

    @cc-cailin

    Hi. I noticed that the title of last post is only displayed when you hover over the freshness link. I’d like to display the title of the last post and the time in brackets. Can anyone help me?

Viewing 9 replies - 1 through 9 (of 9 total)

  • FreeWPress
    Participant

    @freewpress

    Hi, using this function: <?php bbp_forum_last_topic_title(); ?> in loop-single-forum.php it show a title of last topic with no “reply-to” label…


    CC-Cailin
    Participant

    @cc-cailin

    Awesome… great, thank you
    How do I display the time next to it? The <?php bbp_forum_freshness_link (); ?> displays it in link form… and I just want it next to the title in brackets (not linked)


    FreeWPress
    Participant

    @freewpress

    Hi, this is my solution:

    <div class="bbp-forum-last-topic-name"><a href="<?php bbp_forum_last_topic_permalink(); ?>" title="<?php bbp_forum_last_topic_title(); ?>"><?php bbp_forum_last_topic_title(); ?></a></div>

    Create a class in your bbpress css named bbp-forum-last-topic-name and give your personal style…

    Put all code into <li class="bbp-forum-freshness"> </li>


    CC-Cailin
    Participant

    @cc-cailin

    Awesome! Thank you… One more question though.
    After using your code, if there has been no posts made in a forum, it shows a random time (which seems to be the time I created the forum) and the topic title appears blank. How can I do this:

    if the forum has posts, show the latest post title and time (the code you gave me), otherwise show “No topics posted yet”.


    FreeWPress
    Participant

    @freewpress

    In strange, because i use this with no problems, are you sure u have add the code after freshenss in forum loop?? I have opened a new thread here because this metod of Freshness in forum do not work fine, it id discordant from topic Freshness..

    Please write here a link of your forum…


    CC-Cailin
    Participant

    @cc-cailin

    Hey, I modified it a little to fit the needs of my forum…
    I can’t show you the link as I’m working on localhost at the moment, but here is what I did.

    Inside loop-single-forum.php, I removed this:

    <?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?>
    <?php bbp_forum_freshness_link(); ?>
    <?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?>

    And placed this in it’s place:

    <a class="bbp-forum-freshness" href="<?php bbp_forum_permalink(); ?>">
    <?php bbp_forum_last_topic_title(); ?></a> 
    (<?php bbp_forum_last_active_time(); ?>) by <span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?></span>

    Now the last step I need help with is…
    Right now if a forum doesn’t have posts in it yet, it shows the time I created the forum. Which is very weird. So what I i need is a php if/else code that would check if there is a forum_last_topic if there is, it must show my code… if there isn’t, it must show the text “No topics yet”. How do I do this? I have very basic php knowledge


    CC-Cailin
    Participant

    @cc-cailin

    Oh goodness! I get what you meant now!!! The link isn’t going to the topic… it is going to the forum :(


    niuserre
    Participant

    @niuserre

    You have <?php bbp_forum_permalink(); ?> in your code, which I guess should be <?php bbp_last_topic_permalink(); ?> if you want to link to the topic.


    FreeWPress
    Participant

    @freewpress

    Yes, @niuserre is ok!!

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.