asked 8 years ago

I’m trying to display the list of answers using the following query


<? php
$answers = new WP_Query( ‘post_per_page=20&orderby=post_date&post_type=dwqa-answer&author=’.get_query_var(‘author’) );
if ( $answers->have_posts() ) {
echo ‘<div class=”widget dwqa-widget dwqa-latest-questions”>’;
echo ‘<ul>’;
while ( $answers->have_posts() ) { $answers->the_post( );
echo ‘
<li><a href=”‘.get_permalink().'” class=”question-title”>’.get_the_title( ).'</a>’ . human_time_diff( get_the_time( ‘U’ ), current_time( ‘timestamp’ ) ) . ‘ ago’;
echo ‘</ul>’;
echo ‘</div>’;
wp_reset_query( );
? >


However this will only return the questions where the answer is. It doesn’t return the actual answer from the author. I’m a PHP noob so could anyone guide me on how I could return a list of answers and NOT the questions where the answer is?


2 Answers
answered 8 years ago

Unfortunately, DW Q&A plugin does not support to get list answer from a single author.

replied 8 years ago

I know it doesn’t….. that’s why I’m creating one but I’m calling the wrong variable for answers. I hope someone could point me in the right direction.


answered 8 years ago

Apologies for the delay in replying to you.
After adding the query, you should not take ” get_permalink()” function.
get_permalink() is used to link to the questions where the answers is, of course.
You should create the page which have content

Powered by DW Question & Answer Pro