Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get the latest topic link?


  • demonboy
    Participant

    @demonboy

    Hi,

    On my forum archive page I’d like to grab the latest topic permalink and title only on certain forums. Using bbp_topic_title() and bbp_topic_permalink(), how do I get only the latest topic?

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

  • demonboy
    Participant

    @demonboy

    I should add that this appears in loop-single-forum.php where I am including a condition:

    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 40250) or ( $forum_id == 41369) ){
    ?>

    I’d like to then follow this with something that displays the latest topic permalink/title and topic author/avatar.


    demonboy
    Participant

    @demonboy

    I’ve sorted it (excuse formatting):

    if (( $forum_id == 40088) ){
    ?>
    	<?php $args = array( 'post_type' => 'topic', 'posts_per_page' => 1, 'post_parent' => '40088' );
    				$loop = new WP_Query( $args );
    				while ( $loop->have_posts() ) : $loop->the_post();?>
    				<li class="fa-thumb"><div text-align="center"><a class="bbp-topic-permalink" href="<?php bbp_topic_permalink(); ?>"><?php echo get_the_post_thumbnail($post->ID,'thumbnail',array('class' => 'alignleft forum-icon'));?><br>
    				<span class="fa-link"><?php bbp_topic_title(); ?></span></div></li>
    		<?php			
    				endwhile;
    		?>
           
    <?php
        }
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar