Skip to content

Open First Sorting

The Open Now Search Order allows you to sort search results by whether businesses or listings are currently open or closed. Show open listings first to help users find places they can visit right now. This is different than Voxel’s Open filter as that only shows businesses that are CURRENTLY open. This one shows all but shows open first.

Overview

This custom order-by type integrates with Voxel’s search system to prioritize listings based on their real-time open/closed status. It reads from the work hours field and calculates whether each listing is currently open, then sorts accordingly.

Key Features

  • Sort by open/closed status in search results
  • Show open listings first (or closed first if reversed)
  • Support for site timezone or individual post timezone
  • Works with any work hours field
  • Compatible with other order-by options
  • Real-time calculation based on current time

Setup Instructions

Step 1: Enable the Order Type

  1. Navigate to Voxel Toolkit → Functions in your WordPress admin
  2. Find Open Now Order in the list
  3. Toggle the switch to enable
  4. Click Save Changes

Step 2: Configure in Post Type

  1. Go to Voxel → Post Types
  2. Select the post type you want to configure
  3. Navigate to Search → Order By
  4. Click Add Order
  5. Select Open Now from the list
  6. Configure the settings as described below
  7. Save the post type configuration

Configuration Settings

SettingDescriptionOptions
Work Hours FieldSelect the work hours field to use for open/closed calculationAny work-hours type field
TimezoneWhich timezone to use for calculationsSite timezone / Post timezone
OrderSort directionDESC (open first) / ASC (closed first)

Timezone Modes

Site Timezone: Uses your WordPress site’s configured timezone for all calculations. Best for local directories where all listings are in the same timezone.

Post Timezone: Uses each post’s individual timezone setting. Ideal for directories spanning multiple regions or countries where each listing may have its own timezone.

How It Works

  1. When a search is performed, the order type calculates the current minute of the week
  2. It queries the work hours table to check which posts have open hours at the current time
  3. Posts with matching open hours are marked as “open” (value 1)
  4. Posts without matching hours are marked as “closed” (value 0)
  5. Results are sorted by this open/closed status

The calculation accounts for work hours that span midnight and handles timezone conversions when using post timezone mode.

Use Cases

Restaurant Directory

Help hungry users find restaurants that are currently serving by showing open establishments first.

Local Business Directory

Prioritize businesses that users can visit or contact right now, improving the user experience.

Service Provider Listings

Show available service providers first so users can book appointments or services immediately.

Multi-Region Directory

Use post timezone mode for directories spanning multiple time zones to ensure accurate open/closed status for each listing.

Troubleshooting

Order Not Appearing in Options

  • Verify the Open Now Order function is enabled in Voxel Toolkit
  • Clear any caching after enabling
  • Re-index your post type if needed

Incorrect Open/Closed Status

  • Check that the correct work hours field is selected
  • Verify the timezone setting matches your use case
  • Confirm posts have work hours data filled in
  • Check your WordPress timezone setting (Settings → General)

Post Timezone Not Working

  • Ensure posts have a timezone field configured
  • Re-index the post type after changing timezone mode
  • Verify the timezone column exists in the index table

Built by Code Wattz.