Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author DesignWall

    (@designwall)

    Hi aliciawang2012,

    Thanks for writing in.

    You can add this code below to wp-content/themes/your-theme-folder/functions.php:

    add_filter( 'dwqa_prepare_archive_posts', 'dwqa_theme_category_filter' );
    function dwqa_theme_category_filter( $args ) {
    	if ( is_page( 0 ) ) { // Please insert you page ID you want to show question category
    		$args['tax_query'][] = array(
    			'taxonomy' => 'dwqa-question_category',
    			'terms'	=> 'question', // Please insert your category's slug here
    			'field' => 'slug'
    		);
    	}
    
    	return $args;
    }
    
    Thread Starter aliciawang2012

    (@aliciawang2012)

    Hi,

    Thanks for the answer.
    I tried it, but it doesn’t seem working…

    This is the code I put into Theme Functions(function.php).

    add_filter( 'dwqa_prepare_archive_posts', 'dwqa_theme_category_filter' );
    function dwqa_theme_category_filter( $args ) {
    	if ( is_page( 140 ) ) { // Please insert you page ID you want to show question category
    		$args['tax_query'][] = array(
    			'taxonomy' => 'dwqa-question_category',
    			'terms'	=> 'lean-in', // Please insert your category's slug here
    			'field' => 'slug'
    		);
    	}
    
    	return $args;
    }

    Is the shortcode at the front-end still [dwqa-list-questions] ?

    Also, since I have many posts, I want to show all the questions in specific category in each category (for example, I want to show all the questions in “lean-in” category to the post lean-in; all the questions in category XX to post XX), does it mean whenever I add a new post with new question category, I need to modify the function.php like this? Is there any other way to do this?

    Here’s my site with your suggested code put in function.php already : https://bookdigest.club/function-testing-post/
    maybe it helps to explain the problem…

    And thank you very much for the support.

    Plugin Author DesignWall

    (@designwall)

    Hi there,

    Thanks for your reply.

    We will release the new version of DW Q&A in 2 days from now. If you want, we’ll add this feature in the upcoming version of the plugin.

    Should you need further assistance, please contact us again and we’ll be happy to help.

    Regards,
    Anna.

    Thread Starter aliciawang2012

    (@aliciawang2012)

    Thanks, Anna.
    It would be greatly appreciated if this feature is added in.
    I shall update to the new version in 2 days and try again.

    Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to show questions from specific category/tag in a post’ is closed to new replies.