nanodesigns / nanosupport

Create a fully featured Support Center in your WordPress setup without any third party dependency, completely FREE. Get a built-in Knowledgebase too. The plugin is available on WordPress.org repository:
https://wordpress.org/plugins/nanosupport/
GNU General Public License v2.0
50 stars 13 forks source link

Display all the tickets of Specific Department(s) only #45

Closed mayeenulislam closed 6 years ago

mayeenulislam commented 6 years ago

User elizxer requested a feature to let 'em enable displaying all the tickets of specific department/departments only.

I like to know if you can have an option to show supportdesk in specific department where I would want specifica category to display.

mayeenulislam commented 6 years ago

O, I got it. It's actually possible being in the current version. You just have to filter the page query with the Support Desk query filter hook:

ns_filter_support_desk_query

Filter the Support Desk query

For example put the following code into your theme's functions.php to display tickets only of the department ID#268:

add_filter('ns_filter_support_desk_query', function( $args ) {
    $args['tax_query'] = array(
        array(
            'taxonomy' => 'nanosupport_department',
            'field'    => 'term_id',
            'terms'    => 268 // <--------- Your department id here
        )
    );
    return $args;
});

Get the Support Department ID

You can get the term ID by clicking on the Department to edit, or simply by hovering on it:
department-specific-support-desk

WP_Query() Taxonomy Knowledgebase

Read more about the Taxonomy parameters of WP_Query()