most recent questions on (home)page
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..
Still not working. My current code is:
<?php
global $questions;
$questions = 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;
?>
The error I get is:
Fatal error: Uncaught Error: Call to undefined function ap_questions()
Please advice 🙂
Rahul, any words of wisdom? 🙂