Integrating Q&A user profile page with my current user profile page

Hi my name is Ovid,

I recently started using wpmudev Q&A plugin and I love how customizable it is! Unlike similar plugins (WP-Answers for example), this plugin doesn't force you to use a specific theme.

This plugin makes it's own profile page for users. However my site already has a very customized profile page, I want to integrate the Q&A profile page with my current profile page.
More specifically, I want to integrate ONLY the Question and Answer tabs from the Q&A profile page into my profile page (see image below).
http://imgur.com/0Uz26P7

I was wondering how I would go about doing this? I am familiar with php, html, css, and web programming, but am new to wordpress.

I've tried copying code from default-templates/user-question.php into my userprofile.php but this doesn't seem to work :slight_frown: (it always shows 0 questions 0 answers this way)

Any help would be appreciated!

I will make sure to tell my web developer friends about this plugin :slight_smile:

  • Vaughan

    hiya

    thanks for posting.

    are you using 2 loops on the same template?

    you might need to use

    wp_reset_postdata();

    after the 1st loop if they are nested.

    http://codex.wordpress.org/The_Loop

    if you're a developer & new to wordpress, i would bookmark the codex page above, you'll find it extremely helpful.

    it might help if you posted the code you have so far in your custom-profile page.

    hope this helps

    thanks

  • Ovidiu

    Hey Thanks for the link Vaughan! That helped me understand how the wordpress loop works, no I was only using 1 loop to iterate over the posts but I found out my problem was with my instantiation of the loop:

    <?php while ( have_posts() ) : the_post(); ?>

    The above didn't work for me, it was always returning nothing. Instead I wrote my own query:

    $question_query = new WP_Query( array(
    			'author' => get_current_user_id(),
    			'post_type' => 'question',
    			'posts_per_page' => 20,
    		) );

    and then called the loop as follows:

    <?php while ( $question_query->have_posts() ) : $question_query->the_post(); ?>

    I think the problem was that the post_type was question rather than whatever the default query is (I thought the default post type would be ALL so this might not be the reason I was getting nothing back from the loop). But for some reason creating my own query and using that in the loop fixed my issue.

    Thanks again for the link Vaughan! Should I use wp_reset_postdata(); if I only have one loop?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.