Avada Theme – Display results from a specific category [closed]

There are two things you need to keep in mind. In WordPress you have taxonomies and terms. For instance Category is a taxonomy, and let’s say Portfolio is a term belonging to the “Category” taxonomy.

What the code you just posted does is to take all the terms of the “faq_category_1” taxonomy and print all those values as a menu at the top. Then it makes another query to get all the posts of the post type “avada_faq_1” and uses javascript to filter them by term.

If you want to display only the questions of a specific term, you can modify that query:

$args = array(
    'post_type' => 'avada_faq_1',
    'nopaging' => true,
    'tax_query' => array(
        array(
            'taxonomy' => 'my_taxonomy', // Could be "faq_category_1" or a custom taxonomy
            'terms' => $title,
            'field' => 'slug'
        )
     )
);

You can only select terms by either ID or slug, so $title should be converted to slug before making the query, you can do this by using sanitize_title.

Remember that after you change the query the javascript filtering would be pretty much pointless, so you should remove the terms menu at the top.