Title: Create Custom Query
Last modified: August 22, 2016

---

# Create Custom Query

 *  Resolved [astekwebWP](https://wordpress.org/support/users/astekwebwp/)
 * (@astekwebwp)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/create-custom-query/)
 * Great plugin, I’m wondering if there’s a way to customize the output of the directory
   plugin.
 * I’m wanting to group Listings alphabetically by their first alphabet. E.g.
 *  A
    Adam Guy Andrea Swift B Betty White Billy Bob
 * To pull this off with normal WP posts I would do something like this:
 *     ```
       <?php
       $args=array(
         'orderby' => 'title',
         'order' => 'ASC',
         'posts_per_page'=>-1,
         'caller_get_posts'=>1
       );
       $my_query = new WP_Query($args);
       if( $my_query->have_posts() ) {
         echo 'Alphabetic index of all ' . count($my_query->posts) . ' posts';
         while ($my_query->have_posts()) : $my_query->the_post();
           $this_char = strtoupper(substr($post->post_title,0,1));
           if ($this_char != $last_char) {
             $last_char = $this_char;
             echo '<h2>'.$last_char.'</h2>';
           } ?>
           <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
           <?php
         endwhile;
       } //if ($my_query)
       wp_reset_query();  // Restore global post data stomped by the_post().
       ?>
       ```
   
 * So the question is where would I make edits in the plugin for this? And can I
   do this in a way that’s not overwritten on updates?
 * Thanks.
 * [https://wordpress.org/plugins/connections/](https://wordpress.org/plugins/connections/)

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

 *  Plugin Author [Steven](https://wordpress.org/support/users/shazahm1hotmailcom/)
 * (@shazahm1hotmailcom)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/create-custom-query/#post-5805151)
 * **@ astekwebWP**
 * You do not need to edit anything to do this…
 * Got to the Connections : Settings admin page and enable this option under the
   Display tab:
 *  – Show the current character at the beginning of each character group.
 * Now, to change the sort order, use the [order_by shortcode option](http://connections-pro.com/documentation/connections/shortcodes/shortcode-connections/order_by/).
 *  Thread Starter [astekwebWP](https://wordpress.org/support/users/astekwebwp/)
 * (@astekwebwp)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/create-custom-query/#post-5805171)
 * Perfecto!

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

The topic ‘Create Custom Query’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/connections_2b7e99.svg)
 * [Connections Business Directory](https://wordpress.org/plugins/connections/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/connections/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/connections/)
 * [Active Topics](https://wordpress.org/support/plugin/connections/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/connections/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/connections/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [astekwebWP](https://wordpress.org/support/users/astekwebwp/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/create-custom-query/#post-5805171)
 * Status: resolved