how to display user’s question and answer

4.96K viewsGeneral
0

Hello,

I’ve created a custom author.php file for my wordpress site to show user’s commnets,article,questions and answers

how can I list all of the user questions and answers and comments in this page?

which code should I use?
thanks!

0

Thanks @Rahul, this returns the correct questions, but how can we trigger the scripts and styles to load also – as the plugin does not run correctly without these?

Ideally, the shortcode would take additional parameters, so that we can let you control how these different views work.

1

Hello,

Use this code:

global $questions;
$args = [];
$args['ap_current_user_ignore'] = true;
$args['author'] = (int) get_query_var( 'ap_user_id' );
anspress()->questions = $questions = new Question_Query( $args );
include ap_get_theme_location( 'addons/user/questions.php' );