Seb_test
asked 7 years ago

How can i add the list of my questions in the dashboard of my account ? As your site.
Thank you for your help.
Sébastien

1 Answers
Jackie Lord
answered 7 years ago

In order to add List of Question to an account, please open file author.php in your theme folder, and use this Custom Query to list out all the questions of that user/ author:

 // The Query
$the_query = new WP_Query( 'posts_per_page=-1&post_type=dwqa-question&author='.get_query_var('author') );

// The Loop
if ( $the_query->have_posts() ) {
    echo '<ul>'
    while ( $the_query->have_posts() ) {
        $the_query->the_post();
        echo '<li>' . get_the_title() . '</li>';
    }
    echo '</ul>'
} else {
    echo "This author don't have any question.";
}
wp_reset_postdata();

Hope this helps!

Seb_test
replied 7 years ago

Top ! Thanks.

Powered by DW Question & Answer Pro