Ray
asked 1 week ago

This is really important for us.
Is there any way to always display the name of the person who submitted the question, in the question list.
The way it works now is not helpful and its’ really causing us problems – when someone answers the question, the name changes on the question list from the person who asked the question to the person who answered it. Please help us this, again it’s important.
Thank you 
Ray

4 Answers
DominicStaff
answered 1 week ago

You can replace the code in the content-question.php file with the following code:

<?php
/**
 * The template for displaying question content
 *
 * @package DW Question & Answer
 * @since DW Question & Answer 1.4.3
 */

?>
<div class="<?php echo dwqa_post_class(); ?>">
    <div class="dwqa-question-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    <div class="dwqa-question-meta">
        <?php dwqa_question_print_status() ?>
        <?php
            global $post;
            $user_id = get_post_field( 'post_author', get_the_ID() ) ? get_post_field( 'post_author', get_the_ID() ) : false;
            $time = get_the_date( 'm/d/Y' );
            $text = __( 'asked on', 'dw-question-answer' );
            // $latest_answer = dwqa_get_latest_answer();
            // if ( $latest_answer ) {
            //     $time =get_the_date( 'm/d/Y' );
            //     $text = __( 'answered on', 'dw-question-answer' );
            // }
        ?>
        <?php printf( __( '<span><a href="%s">%s%s</a> %s %s</span>', 'dw-question-answer' ), dwqa_get_author_link( $user_id ), get_avatar( $user_id, 48 ), get_the_author(), $text, $time ) ?>
        <?php echo get_the_term_list( get_the_ID(), 'dwqa-question_category', '<span class="dwqa-question-category">' . __( '&nbsp;&bull;&nbsp;', 'dw-question-answer' ), ', ', '</span>' ); ?>
    </div>
    <div class="dwqa-question-stats">
        <span class="dwqa-views-count">
            <?php $views_count = dwqa_question_views_count() ?>
            <?php printf( __( '<strong>%1$s</strong> views', 'dw-question-answer' ), $views_count ); ?>
        </span>
        <span class="dwqa-answers-count">
            <?php $answers_count = dwqa_question_answers_count(); ?>
            <?php printf( __( '<strong>%1$s</strong> answers', 'dw-question-answer' ), $answers_count ); ?>
        </span>
        <span class="dwqa-votes-count">
            <?php $vote_count = dwqa_vote_count() ?>
            <?php printf( __( '<strong>%1$s</strong> votes', 'dw-question-answer' ), $vote_count ); ?>
        </span>
    </div>
</div>
Ray
answered 1 week ago

This is perfect!
Thank you so much Dominic!!!

Ray
answered 1 week ago

It even has the date instead of the elapsed time that I asked for.
Excellent support Dominic! I am so grateful!!!

DominicStaff
answered 5 days ago

You’re welcome. Please let me know if you have any issue or question.

Powered by DW Question & Answer Pro