{"id":756,"date":"2025-03-24T14:27:36","date_gmt":"2025-03-24T14:27:36","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/changing-or-adding-new-sorting-options\/"},"modified":"2025-04-03T15:23:56","modified_gmt":"2025-04-03T14:23:56","slug":"changing-or-adding-new-sorting-options","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/core-features\/changing-or-adding-new-sorting-options\/","title":{"rendered":"Changing or Adding New Sorting Options"},"content":{"rendered":"\n<p>This is one of the <strong>most powerful and underused features<\/strong> of GeoDirectory! With the Sorting options builder, you can <strong>create custom sort options based on your custom fields<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What are Sorting Options?<\/h2>\n\n\n\n<p><strong>Sort options let you order listing results in a specific way<\/strong>. By default, listings are sorted by &#8220;<em><strong>Newest<\/strong><\/em>&#8221; meaning that newly added listings will be shown first.<\/p>\n\n\n\n<p>Sort options can be&nbsp; <strong>used in many places<\/strong> including on<strong> archive pages<\/strong> and in <strong>GD &gt; Listings widgets<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\">The <strong>results on the Search pages<\/strong> are ordered with relevance to the search query input by your visitors.<\/span><\/div>\n\n\n\n<p>Some of the sort option features are;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Most <strong>default fields<\/strong> can be used as a sort option.<\/li>\n\n\n\n<li>Most <strong>custom fields<\/strong> can be used as a sort option.<\/li>\n\n\n\n<li>Add <strong>as many different sort options as are needed<\/strong>.<\/li>\n\n\n\n<li><strong>Enable a field to be a sort option<\/strong> by selecting &#8220;<i style=\"font-weight: bold;\">Include this field in sorting options&#8221; <\/i>under the <strong>edit field > show advanced<\/strong> options.<\/li>\n\n\n\n<li>A single sort option can have <strong>many sorting factors<\/strong>.<\/li>\n\n\n\n<li>Any Sort option can be <strong>set as the default<\/strong> for that CPT.<\/li>\n\n\n\n<li><figure><img loading=\"lazy\" decoding=\"async\" sizes=\"auto, (max-width: 339px) 100vw, 339px\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-QzJVaVFFXB.png 339w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-QzJVaVFFXB-300x261.png 300w\" width=\"339\" height=\"295\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-QzJVaVFFXB.png\" alt=\"\"><\/figure><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Field Settings<\/h2>\n\n\n\n<p>If a field can be used to create a sorting option, you will see this in the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/how-to-add-a-custom-field-to-custom-post-type\/\" target=\"_blank\" rel=\"noopener\">Custom Field settings<\/a>.&nbsp;<\/p>\n\n\n\n<p>Check this option to include the field in the sorting option<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-rMkQBXsx3R-569x1024.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Adding or Editing a Sort Option<\/h2>\n\n\n\n<p>Each Custom Post Type (CPT) has its own separate sort options.&nbsp; Sort option settings are under the CPTs settings, <strong>Places &gt; Settings &gt; Sorting.<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Example<\/h3>\n\n\n\n<p>Let&#8217;s create an example using our real-estate dummy data and add a new sort option that orders listings by the size of the property.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The <strong><em>Area<\/em><\/strong> custom field should already be showing as an <strong>available sort type<\/strong>, <strong>click that to add it<\/strong> to the sort options.<br><figure><img loading=\"lazy\" decoding=\"async\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-LYOoi4Db92.png 437w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-LYOoi4Db92-300x172.png 300w\" width=\"437\" height=\"250\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-LYOoi4Db92.png\" alt=\"\"><\/figure><\/li>\n\n\n\n<li><p>You will then be presented with the settings for the sort option;<\/p><ul><br><li><strong>Frontend title<\/strong> &#8211; This is the text used for the sort option.<\/li><br><li><strong>Ascending or Descending<\/strong> &#8211;\u00a0Select the sort direction: (A-Z or Z-A)<\/li><br><li><strong>Default sort<\/strong> &#8211;\u00a0This sets the option as the overall default sort value, there can be only one.<\/li><br><li><strong>Is active<\/strong> &#8211;\u00a0Set if this sort option is active or not, if not it will not be shown to users.<\/li><br><\/ul><br><p>We set the title as\u00a0<br><i style=\"font-weight: bold;\">Largest Area (Sq Ft) <\/i>and the sort direction to <strong><em>Descending<\/em><\/strong> (largest to smallest) and set it <strong>active<\/strong>.<\/p><\/li>\n\n\n\n<li><p><strong>Drag the sort option up or down to set the position in the list.<br><img loading=\"lazy\" decoding=\"async\" sizes=\"auto, (max-width: 568px) 100vw, 568px\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-P0C7V4r0Mj.png 568w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-P0C7V4r0Mj-300x252.png 300w\" width=\"568\" height=\"478\" class=\"attachment-large size-large\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-P0C7V4r0Mj.png\" alt=\"\"><\/strong><\/p><\/li>\n<\/ol>\n\n\n\n<p>The results on the frontend after selecting the new option will order listings by the largest area first<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-Q77cAigTsS.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Featured<\/h2>\n\n\n\n<p>Sort listing by whether they are featured or not, showing the featured listings first. This is a great way to promote listings that receive special consideration.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-deyllHhmK9.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Nest Different Sort Options?<\/h2>\n\n\n\n<p>GeoDirectory allows nesting of sorting options. For instance, you can&nbsp;add &#8220;Featured&#8221; as a field, and then change the Title to &#8220;A-Z&#8221; then add the Title field as a sub-item or nested item. Doing so will sort first by featured, and then by title.&nbsp;<\/p>\n\n\n\n<p>To accomplish this, you&#8217;d follow the same model as for adding other sorting options, but instead, simply add the nested field as a sub-item.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-1lizqXcyPr-1024x468.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>In the above image, GD will first sort the listings by Newest, and if two listings have the same date, it will sort them alphabetically. Perchance the titles are also the same, it will sort by ratings.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\">Note that nested sort options are not shown on the frontend. These are just hidden secondary sort options that allow you to adjust or tweak the sorting options.<\/span><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Sorting with GD Listings<\/h3>\n\n\n\n<p>Sorting options can also be used in the GD &gt; Listings widget.<br>To apply sorting, open the GD Listings widget and find the sorting features section.<br>From the select field, select the sorting options you would like to apply to the GD Listings widget.<br>All the single field sorting options you have configured should be available to select.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is one of the most powerful and underused features of GeoDirectory! With the Sorting options builder, you can create custom sort options based on your custom fields. What are Sorting Options? Sort options let you order listing results in a specific way. By default, listings are sorted by &#8220;Newest&#8221; meaning that newly added listings [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[603,604,545,602],"article\/categories":[421,213],"class_list":["post-756","gd_place","type-gd_place","status-publish","hentry","gd_place_tags-sort","gd_place_tags-filtering","gd_place_tags-filters","gd_place_tags-sorting","gd_placecategory-core-features","gd_placecategory-extensions-features"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=756"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/756\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=756"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=756"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}