vahid
asked 11 years ago

Hello I’ve created a custom author.php file for my wordpress site. how can I list all of the user questions and answers and comments in this page? which code should I use?

5 Answers
vahid
answered 11 years ago

I finally found the code that I want!
 
to list all of questions:
 
<ul>
<?php
$curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author));
query_posts( array(
‘post_type’ => array(‘dwqa-question’),
‘author’ => $author )
);
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”><?php the_title(); ?></a>
</li>
<?php endwhile; else: ?>
<p>no questions found</p>
<?php endif; ?><?php wp_reset_query(); ?>
</ul>
 
and to list answers:
 
<ul>
<?php
$curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author));
query_posts( array(
‘post_type’ => array(‘dwqa-answer’),
‘author’ => $author )
);
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”><?php the_title(); ?></a>
</li>
<?php endwhile; else: ?>
<p>no answers found</p>
<?php endif; ?><?php wp_reset_query(); ?>
</ul>

DominicStaff
answered 11 years ago

Hi,
Thanks for pointing on our question & answer forum ! Unfortunately, the DW Q&A plugin does not yet support a author page.
However, you can use Member list plugin to help you out. Please find the plugin here:https://wordpress.org/plugins/members-list/
Try it and let us know your experience, my friend 🙂

vahid moh
replied 11 years ago

I don’t want to list users! I want to list questions of user.. There should be a php code which shows the questions that a user has asked.

DominicStaff
answered 11 years ago

Please read more about WordPress Query here: http://codex.wordpress.org/Class_Reference/WP_Query

vahid moh
replied 11 years ago

sorry but I don’t have any information about this link. in designwall.com there’s a user profile which shows all of the things I’m searching for. is it possible that you add these features in your next version of plugin?

Guru
answered 11 years ago

You can use buddypress and the custom code from DW to make a listing of all the questions an author/contributor has asked

vahid moh
replied 11 years ago

isn’t there anyway to use it in WordPress without buddypress?

weEatComplete
answered 7 years ago

Did anything ever get done with this?

Powered by DW Question & Answer Pro