Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display topic list of a specific forum


  • lucju04
    Participant

    @lucju04

    Hi everybody,

    I’m actually developing a Forum for a WordPress site.

    My Home is composed by 3 sections. Each section is a Forum who list child forum (I’m ok with that it’s already ok). But the last section need to be a Forum who list topics of this Forum.

    But when I try to use <?php echo do_shortcode( ‘[bbp-single-forum id=123]‘ ); ?> it’s a mess.

    my content-archive-forum.php looks like:

    
    <div id="bbpress-forums">
    
    	<div class="bbpress-header">
    		<div class="bbpress-header__image">
    			<img src="image.png" alt="Illustration sabre - Forum">
    		</div>
    		<div class="bbpress-header__headline"><h1>Welcome</h1></div>
    		<div class="bbpress-header__lead-paragraphe">
    			<p>
    				Lorem ipsum dolor sit amet, consectetur adipiscing elit. <span>Donec vel auctor diam.</span> 
    				Nulla odio diam, maximus ut libero ut, <span>pharetra ullamcorper</span> orci. Sed magna nisl, 
    				pellentesque at ligula nec, condimentum viverra. Petit texte d’intro sur le forum (juste une idée)?
    			</p>
    		</div>
    	</div>
    
    	<?php bbp_get_template_part('user', 'bar'); ?>
    
    	<?php bbp_breadcrumb(); ?>
    
    	<?php bbp_forum_subscription_link(); ?>
    
    	<?php do_action( 'bbp_template_before_forums_index' ); ?>
    
    	<?php if ( bbp_has_forums() ) : ?>
    
    		<?php bbp_get_template_part( 'loop','forums'); ?>
    
    	<?php else : ?>
    
    		<?php bbp_get_template_part( 'feedback', 'no-forums' ); ?>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_forums_index' ); ?>
    
    </div>

    How I can just add a section who display juste the list of the topic for a specific forum ?

    Best regards ! 🙂

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

  • Robin W
    Moderator

    @robin-w

    But when I try to use <?php echo do_shortcode( ‘[bbp-single-forum id=123]‘ ); ?> it’s a mess.

    without knowing what ‘it’s a mess’ means, not sure I can help – do you have a link to the site?


    lucju04
    Participant

    @lucju04

    Sadly no it’s on my local wamp. But I can explain you of course (my bad it’s blur !).

    I just tried to analyse what’s happend to explain to you. And I realize that
    <?php echo do_shortcode( ‘[bbp-single-forum id=123]‘ ); ?> did the same template content-archive-forum.php but with the [bbp-single-forum id=123] at the end.

    It seems like there is something wrong with a loop or something. Do you know where I can learn what [bbp-single-forum id=123] did exactly ?


    Robin W
    Moderator

    @robin-w

    sure it’s in

    \bbpress 2.5.13\includes\common\shortcodes.php


    lucju04
    Participant

    @lucju04

    Hi,

    Based on my content-archive-forum.php.

    I would like to creat a custom WP_Query like:

    <?php $args = array( 'post_type' => 'topic', 'posts_per_page' => 10, 'post_parent' => '410' );
    				$loop = new WP_Query( $args );
    				while ( $loop->have_posts() ) : $loop->the_post();
    				the_title();
    					
    				endwhile;
    		?>

    to list topic of forum with ID=410 and also message counter and freshness if it’s possible .. But I didn’t find the way to do this… Do you have a tips or exemple ? This will be very helpfull because It can solve many issue I have ahah


    Robin W
    Moderator

    @robin-w

    what is the issue with your code above?


    namalux
    Participant

    @namalux

    I think this should be correct


    lucju04
    Participant

    @lucju04

    I don’t really find a solution but as my home is not destined to change, I just created a custom “static” section. It’s answer to all my issues.

    My section looks like:

    <section class="bbp-forum-table__container"> 
    	<div class="bbp-forum-table__content style-<?php bbp_forum_id(); ?>">
    		<div class="bbp-forum-table__content--forum-list">
    			<div class="bbp-forum-table__header--grid">
    				<div>Discussions générales</div>
    				<div>Participants</div>
    				<div>Réponses</div>
    				<div></div>
    				<!-- <span>Dernier message</span> -->
    			</div>
    				<?php $args = array( 'post_type' => 'topic', 'posts_per_page' => 10, 'post_parent' => '410' );
    					$loop = new WP_Query( $args );
    					while ( $loop->have_posts() ) : $loop->the_post(); ?>
    						<div class="bbp-forum-table__content--grid ">
    					
    							<div class="topic-title"><a href="<?php bbp_topic_permalink(); ?>"><?php the_title(); ?></a></div>
    					
    							<div class="replies-counter"><?php bbp_topic_voice_count(); ?></div>	
    					
    							<div class="posts-counter"><?php bbp_topic_post_count(); ?></div>
    						
    							<div class="user-freshness"></div>	
    						
    						</div>
    				<?php endwhile;?>
    		</div>
    	</div>
    </section>

    I just need to add user-freshness.

    Thanks for you help of course 😉

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