Shortcode for recent questions

7.81K viewsCore
0

I would like to have a section on my homepage with the most recent questions (like on the http://anspress.io homepage). Will there be a shortcode for this?

1

@David, simply use this PHP:

<?php
ap_get_questions(array('showposts' => 5));
?>
 
<?php if ( ap_have_questions() ) : ?>
	<div class="ap-questions">
		<?php					
			/* Start the Loop */
			while ( ap_questions() ) : ap_the_question();
				ap_get_template_part('content-list');
			endwhile;
		?>
	</div>
<?php ap_questions_the_pagination(); ?>
<?php
	else : 
		ap_get_template_part('content-none');
	endif; 
?>
You are viewing 1 out of 4 answers, click here to view all answers.