most recent questions on (home)page

5.43K viewsWordPress
0

Hi There,

I want to display the most recent 5 or 10 questions on my homepage.
Are there customization I can make to the standard shortcode to limit the number of questions displayed?
I also found this code:

<?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;
?>

But it gives a:
Sorry! No question found.

While there are hundreds of questions..

0

Hello,
Sorry for delayed answer. Check this widget code for working example.
https://github.com/anspress/anspress/blob/master/widgets/questions.php
cheers.

You are viewing 1 out of 2 answers, click here to view all answers.