Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to show list foruns in homepage without shortcode


  • Angelo Rocha
    Participant

    @angelorocha

    I need create a query to bring the list of forums and subforums on the homepage of my website, i woudn’t like to use shortcodes cuz i want create a custom style. I did a wp-query but i can’t use functions to show the topic, replies and posts quantity.

    <?php
    	$args = array(
    		'post_type' => 'forum',
    		'order' => 'DESC',
    		'orderby' => 'date'
    	);
    	$query = new WP_Query($args);
    ?>
    Foruns|
    Posts
    <?php if( $query -> have_posts() ): ?>
    	<?php while ($query -> have_posts() ) : $query -> the_post(); ?>
    		<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    			<?php the_title(); ?>
    		</a>
    		
    		<?php $value = bbp_get_forum_post_count(); echo $value; ?>
    		
    	<?php endwhile; ?>
    	
    	<?php wp_reset_postdata(); ?>
    	
    <?php else: ?>
    	Nothing yet...
    <?php endif; ?>

    Thanks for help.

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