Show latest X questions in theme template?

4.40K viewsGeneral
0

Are there shortcodes we can use in order to show the list of questions in the homepage for example? I would like to show the last 5 questions and output them using the same layout you use (I will use CSS to change stuff here and there.)

Thanks!

0

No shortcode but you can try this:

<div id="anspress" class="home-qs-list">
	<?php $questions = ap_get_questions( array( 'showposts' => 10 ) ); ?>
	<?php if ( $questions->have_posts() ) : ?>
		<div class="ap-questions">
			<?php
				/* Start the Loop */
				while ( $questions->have_posts() ) : $questions->the_post();
					ap_get_template_part('content-list');
				endwhile;
			?>
		</div>
	<?php endif; ?>
</div>