Answers Order

4.39K viewsGeneral
0

I want the users cans see the answers in the questions from old to new. So I have checked in the options ‘oldest’.

But in the user Answers page, I want to see the anwers from new to older.

 

So I modified the answer-loop.php to make a new query. It works, but the dates of the answers are incorrect. In the first page all answers get the same date, in the second page all answers have other date, but is the same for all the page.

Here’s my file:

<div id="ap-lists">
	<h3 class="ap-user-page-title clearfix">
		<?php echo ap_page_title() ?>
	</h3>
	<?php if ( ap_have_answers() ) : ?>
		<div class="ap-answers">
			<?php				
				$authorID = ap_answer_get_author_id();
				$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
				$args = array(
					'post_type' => 'answer',
					'author' => $authorID,
					'orderby' => 'meta_value',
					'paged' => $paged,
					'order' => 'DESC'
				);

				$the_query = new WP_Query( $args );

				while ( $the_query->have_posts() ) : $the_query->the_post();
					ap_get_template_part('user/list-answer');
				endwhile ;
			?>
		</div>
	<?php ap_answers_the_pagination(); ?>
	<?php
		else : 
			include(ap_get_theme_location('content-none.php'));
		endif; 
	?>	
</div>

How can i fix this? Or is another easy way to do it?

Thanks a lot!!

0

Simply chnage orderby value to date