Shortcode for recent questions

7.71K 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?

0

Great! Thanks!

Would this be in place of the shortcode or would it be in addition to it on the same page as it?

Also, would this limit to 5 posts automatically?

Thanks,

Please avoid asking question in other question, you can create your own question and its 100% free :D. I just updated my last answer, now it will only show 5 questions. You have to add this code manually in files. or you can install “Shortcode Exec PHP” plugin and then you can directly add this php code widget. cheers.

Ok, Thanks!

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

Is it possible to make a shortcode with a property to limit to the latest posts? The widget won’t work for where I want this to appear.

 

Thanks,

0

Its already there, questions widget. But I have not checked that widget after 2.0.0-alpha.