Rian Botha
asked 10 years ago

I would like to include the latest questions from DWQA on the home page of my DW Wall site. How can I add it to the loop?

Caroline Zambon
replied 10 years ago

Hi Rian, can you share how you solved this problem? I’m having the same problem and this is no code here… I’d like to show only the 2 or 3 lastest questions on home page. Today, I’m using the shortcode [dwqa-list-questions] but I’d like to show just the 2 or 3 lastest questions. Thank you!!!

Rian Botha
replied 10 years ago

You can create a custom WP Query that pulls in the dwqa-question custom post-type.
We did this to add it to our home page loop:

function add_my_custom_post_types( $query ) {
if(is_front_page()) :
if ($query->is_main_query())
$query->set( ‘post_type’, array(‘post’,’dwqa-question) );
endif;
return $query;
}
add_action( ‘pre_get_posts’, ‘add_my_custom_post_types’ );

Rian Botha
replied 10 years ago

That goes in your functions.php file

1 Answers
DominicStaff
answered 10 years ago

To include DWQA question on home page, You can log in to Dashboard > Setting > Reading then select “Front pages” section. (Example: Ask Question) See the screenshot:

Rian Botha
replied 10 years ago

I don’t want to replace the home page with only questions. I want to mix the latest questions in with my latest posts as additional tiles.

Dominic Staff
replied 10 years ago

Currently, Our DW Wall does not yet support this issue. We will discuss about the issue in the next version.

Rian Botha
replied 10 years ago

I have modified the WordPress query to include the post type.

Dominic Staff
replied 10 years ago

I think you have resolved the issue. I appreciate it !

Powered by DW Question & Answer Pro