Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #4889

    felipeoliveira
    Participant
    Points: 9

    How can I sort the FAQs?

    Is there a way I can I filter FAQs by category in the admin?

    Thank you.

    #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, 6 months ago by  Tony. Reason: MU Plugin Development Tutorial Link Added
    Attachments:
    You must be logged in to view attached files.
    #4891

    Tony
    Staff
    Points: 18

    And I’m really sorry I missed your first question.

    If you wanna sort your questions in the front-end, you can set the order from the page where you add your faq questions.

    In “Add New Question” page, you will see a box on top-right section which looks like the image below. You can set your question sequence there.

    <center>Question Order No.</center>

    Cheers!

    #4894

    felipeoliveira
    Participant
    Points: 9
    This reply has been marked as private.
    #4896

    Sushi
    Staff
    Points: 199

    Hi Felipeoliveira,

    First of all, the forum is public, so never post username & password in a public post. I have made it private though. If you need to send us any secured information, make sure you check the box for “Set as Private reply” like the screenshot.

    About your issue, I can see the sorting problem in your site, but can’t replicate it in our site. Would you please send us your FTP details? Access of FAQ plugin folder only would work. And again, make sure you check the box for “Set as Private reply” 🙂

    About previous issue, you need to use either way 1 or way 2. If you go for mu-plugins, you need to start with < ?php tag. Please check this article: https://duogeek.com/blog/how-to-create-a-wordpress-mu-plugin/

    I am also including the FAQ developer Damien in this thread so that he can check once you send the FTP information.

    Thank you for your patience.

    Regards
    Sushi

    Attachments:
    You must be logged in to view attached files.
    #4899

    Sushi
    Staff
    Points: 199

    Sorry I missed this part:

    NOTE: It wold be nice to have the sort order field appear in the FAQ list in the admin so that we can have an overview and change the order using QUICK EDIT instead of having to go to each individual FAQ. Even better wold be drag and drop.

    This is already in our feature list. Currently we are working on a new plugin, maybe this week we will release the plugin (no ETA though :p ) and after that we will work on this feature in FAQ plugin.

    Regards
    – Sushi

    #4900

    felipeoliveira
    Participant
    Points: 9
    This reply has been marked as private.
    #4901

    Sushi
    Staff
    Points: 199

    Hi there

    Please check the sorting now. There was a bug and we released an update.

    About the FTP, it lets me in at an empty directory, the path was not correct.

    Remove the above code from the place you added. Then follow the mu-plugins rule and add the following code:

    
    <?php
    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' );
    

    Let us know if that works for you.

    – Sushi

    • This reply was modified 2 years, 6 months ago by  Sushi.
    #4909

    felipeoliveira
    Participant
    Points: 9

    Thank you Sushi. All is working well now.

    All the best,

    Felipe

    #4911

    Sushi
    Staff
    Points: 199

    Thanks for confirming 🙂

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.