#4890

Tony
Staff
Points: 18

Hi Felipeoliveira,

It’s really a good point what you asked. It’s not available in the current version of DuoFAQ yet, but we will include it in the next version for sure. Till then, you can get your desired filter in two ways.

Way One:
# Create a folder named “mu-plugins” inside your wp-content folder.
# Download the file from attachment.
# Extract the zip and you will get a php file inside.
# Upload that php file (duofaq-cat-filter.php) inside your “mu-plugins” folder.
# Done

If you want to learn more about creating MU Plugins, you can see our blog post at here: https://duogeek.com/blog/how-to-create-a-wordpress-mu-plugin/

Way Two:
Copy and paste the following code in your functions.php file of your theme…

function duofaq_add_categories_filters() {
	global $typenow;
 
	$taxonomies = array('faq_categories');
 
	if( $typenow == 'faq' ){
 
		foreach ($taxonomies as $tax_slug) {
			$tax_obj = get_taxonomy($tax_slug);
			$tax_name = $tax_obj->labels->name;
			$terms = get_terms($tax_slug);
			if(count($terms) > 0) {
				echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
				echo "<option value=''>Show All $tax_name</option>";
				foreach ($terms as $term) { 
					echo '<option value='. $term->slug, $_GET[$tax_slug] == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>'; 
				}
				echo "</select>";
			}
		}
	}
}
add_action( 'restrict_manage_posts', 'duofaq_add_categories_filters' );

Though we will suggest you to follow the first way so that in case your theme gets updated, you don’t loose this hack.

And don’t forget to update DuoFAQ when we release the next version.

Feel free to ask in our support forum if you have any other query regarding our products or general wordpress. Have a nice day.

  • This reply was modified 2 years, 1 month ago by  Tony. Reason: MU Plugin Development Tutorial Link Added
Attachments:
You must be logged in to view attached files.