Title: display sort order
Last modified: July 3, 2019

---

# display sort order

 *  [wasanajones](https://wordpress.org/support/users/wasanajones/)
 * (@wasanajones)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/display-sort-order/)
 * Hi – thanks for your plugin
 * I’ve got
    [faqs style=”toggle” filter=”group-slug”]
 * is there a way to display the group alphabetically? or some other order?
 * I think there are some WP codex parameters that might work in the shortcode but
   I can’t figure it out
 * thanks

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Sungraiz Faryad](https://wordpress.org/support/users/sungraiz/)
 * (@sungraiz)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/display-sort-order/#post-11717052)
 * Hi,
 * You can use the below-given shortcode to display the faqs groups in your desired
   order.
 * [faqs filter=”group-slug,another-group-slug”]
 * Let me know if you need any further assistance in this regard.
 * Thanks,
 *  [immewnity](https://wordpress.org/support/users/immewnity/)
 * (@immewnity)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/display-sort-order/#post-11726547)
 * Hi sungraiz, this does not answer the question posed. The original poster (as
   well as myself) are looking for a way to alphabetically list the FAQs.
 * For example, let’s say the following is currently shown:
 * * Pear
    * Apple * Pineapple * Banana
 * Is there any way to make it go:
 * * Apple
    * Banana * Pear * Pineapple
 * It appears that the default sorting shows newest FAQs on top, but this isn’t 
   always the most useful.
 *  [Sungraiz Faryad](https://wordpress.org/support/users/sungraiz/)
 * (@sungraiz)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/display-sort-order/#post-11733762)
 * Hi,
 * Unfortunately, there is no option for this. You have to make the code modifications
   in order to achieve this.
 * Please add the below-given parameter as guided in the following screenshot.
 *     ```
        'order' => 'ASC',
                       'orderby' => 'title',
       ```
   
 * [https://jmp.sh/2PrVnBZ](https://jmp.sh/2PrVnBZ)
 * Thanks & Regards,
 *  [graftedin](https://wordpress.org/support/users/graftedin/)
 * (@graftedin)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/display-sort-order/#post-11749427)
 * Can I suggest that you do a sort like we do for pages (Order)? Then I don’t need
   to go through and get a list of all of my group slugs. AND what works for groups
   is needed for questions too. Your plugin will probably not work for my project
   because of the sorting issue.
 *  Plugin Author [Usman Ali Qureshi](https://wordpress.org/support/users/usmanaliqureshi/)
 * (@usmanaliqureshi)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/display-sort-order/#post-11750927)
 * Hi [@graftedin](https://wordpress.org/support/users/graftedin/),
 * We will try to provide an option to sort the FAQs in the shortcode in a future
   update. For now, if you want to sort then you can follow the instructions provided
   by [@sungraiz](https://wordpress.org/support/users/sungraiz/).
 * Thanks & Regards
 *  [graftedin](https://wordpress.org/support/users/graftedin/)
 * (@graftedin)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/display-sort-order/#post-11810643)
 * [@usmanaliqureshi](https://wordpress.org/support/users/usmanaliqureshi/) the 
   sort does not work while maintaining the groups.
 *  [graftedin](https://wordpress.org/support/users/graftedin/)
 * (@graftedin)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/display-sort-order/#post-11810696)
 * [@usmanaliqureshi](https://wordpress.org/support/users/usmanaliqureshi/) The 
   problem seems to be that in toggles_grouped_faqs you are looping through all 
   of the groups rather than filter_array.
 * If filter_array is empty THEN you can loop through all groups. And as you loop
   though each group (filer_array or all groups) you can then call the individual
   group to get the rest of its info if needed…because filer_array won’t have all
   of that. And just like that your plugin works as expected.
 * Here is my replacement function. Can I ask that you add this to the next release.
 *     ```
       private function toggles_grouped_faqs( $filter_array ) {
   
           if(!empty($filter_array)){
             $faq_groups = $filter_array;
           }
           else {
             $faq_groups = get_terms( 'faq-group' );
           }
   
           if ( ! empty( $faq_groups ) && ! is_wp_error( $faq_groups ) ) {
   
               foreach ( $faq_groups as $faq_group ) {
   
                   if(!isset($faq_group->term_id)){
                     $faq_group = get_term_by( 'slug', $faq_group, 'faq-group' );
                   }
   
                   $faqs_query = new WP_Query( array(
                           'post_type' => 'faq',
                           'posts_per_page' => -1,
                           'tax_query' => array(
                               array (
                                   'taxonomy' => 'faq-group',
                                   'field'    => 'slug',
                                   'terms'    => $faq_group->slug,
                               )
                           ),
                       )
                   );
   
                   // FAQs Toggles
                   if ( $faqs_query->have_posts() ) :
                       echo '<h4 class="qe-faqs-toggles-group-title">' . $faq_group->name . '</h4>';
                       echo '<div class="qe-faqs-toggles-group">';
                       while ( $faqs_query->have_posts() ) :
                           $faqs_query->the_post();
                           ?>
                           <div class="nojs qe-faq-toggle active">
                               <div class="qe-toggle-title">
                                   <strong><i class="fa fa-minus-circle"></i> <?php the_title(); ?></strong>
                               </div>
                               <div class="qe-toggle-content">
                                   <?php the_content(); ?>
                               </div>
                           </div>
                           <?php
                       endwhile;
                       echo '</div>';
                   endif;
   
               }
   
               // All the custom loops ends here so reset the query
               wp_reset_query();
   
           }
   
       }
       ```
   
    -  This reply was modified 6 years, 9 months ago by [graftedin](https://wordpress.org/support/users/graftedin/).

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘display sort order’ is closed to new replies.

 * ![](https://ps.w.org/quick-and-easy-faqs/assets/icon-256x256.png?rev=2287561)
 * [Quick and Easy FAQs](https://wordpress.org/plugins/quick-and-easy-faqs/)
 * [Support Threads](https://wordpress.org/support/plugin/quick-and-easy-faqs/)
 * [Active Topics](https://wordpress.org/support/plugin/quick-and-easy-faqs/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/quick-and-easy-faqs/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/quick-and-easy-faqs/reviews/)

 * 7 replies
 * 5 participants
 * Last reply from: [graftedin](https://wordpress.org/support/users/graftedin/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/display-sort-order/#post-11810696)
 * Status: not resolved