Skip to:
Content
Pages
Categories
Search
Top
Bottom

Directly to latest post of Topic


  • DKB
    Participant

    @dkb

    Hi, is there a way to make a link for the latest post on the forum homepage, so a vistor can go directly to that instead of navigation through the pages.

    I am using bbPress 1.0.2

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • <?php $last_post = bb_get_last_post(); ?><a href="<?php echo get_post_link($last_post->post_id); ?>">Latest post</a><?php unset($last_post); ?>

    Put that in your front-page.php in the parts you want the latest post link to appear. Try after <?php topic_page_links(); ?>

    Slightly lighter version <a href="<?php post_link($topic->topic_last_post_id); ?>">Latest</a>


    DKB
    Participant

    @dkb

    It works but i get it on the wrong row.

    Here is the code:

    <?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    <td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a><?php topic_page_links(); ?></td>
    <td class="num"><?php topic_posts(); ?></td>
    <!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
    <td class="num"><?php topic_last_poster(); ?></td>
    <td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>

    how can i get it after the topic pages and can i add i image instead of latest?

    <?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
    <tr<?php topic_class(); ?>>
    <td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a><?php topic_page_links(); ?> <a href="<?php post_link($topic->topic_last_post_id); ?>">Latest</a></td>
    <td class="num"><?php topic_posts(); ?></td>
    <!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
    <td class="num"><?php topic_last_poster(); ?></td>
    <td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>

    Just change the word Latest to whatever you like :)

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar