#adminmenu a[href*="page=abddir-upgrade"]{color:#f59e0b;font-weight:600}#adminmenu a[href*="page=abddir-upgrade"]:hover{color:#d97706}'; } ); // Redirect Add New submenu click → dashboard with create form auto-open add_action( 'admin_init', function() { if ( isset($_GET['page']) && $_GET['page'] === 'abddir-add-new' && current_user_can('manage_options') ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only redirect, no state change wp_safe_redirect( admin_url('admin.php?page=abddir-dashboard&create=1') ); exit; } } ); // ─── Enqueue Admin Assets ───────────────────────────────────────────────────── function abddir_admin_enqueue( $hook ) { $screen = get_current_screen(); $screens = [ 'toplevel_page_abddir-dashboard', 'business-directory_page_abddir-settings', 'business-directory_page_abddir-docs', 'business-directory_page_abddir-support', 'business-directory_page_abddir-upgrade', ]; $is_abddir_screen = in_array( $hook, $screens ) || ( $screen && $screen->post_type === 'abddir_listing' ); if ( ! $is_abddir_screen ) return; wp_enqueue_style( 'abddir-admin-css', abddir_PLUGIN_URL . 'admin/css/admin.css', [], abddir_VERSION ); wp_enqueue_script( 'abddir-admin-js', abddir_PLUGIN_URL . 'admin/js/admin.js', [ 'jquery' ], abddir_VERSION, true ); wp_localize_script( 'abddir-admin-js', 'abddirAdmin', [ 'ajaxUrl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('abddir_admin_nonce'), ]); } add_action( 'admin_enqueue_scripts', 'abddir_admin_enqueue' ); // ─── Main Router ────────────────────────────────────────────────────────────── function abddir_render_main() { if ( ! current_user_can('manage_options') ) { wp_die( 'You do not have permission to access this page.' ); } $view = sanitize_text_field( wp_unslash( $_GET['view'] ?? '' ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- display router, no state change $dir_id = intval( $_GET['dir_id'] ?? 0 ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- display router, no state change if ( $view === 'dir' && $dir_id ) { $directory = get_post( $dir_id ); if ( ! $directory || $directory->post_type !== 'abddir_directory' ) { echo '

Directory not found.

'; abddir_render_home(); return; } abddir_render_directory_view( $dir_id ); } else { abddir_render_home(); } } // ─── Handle Directory Form Actions (runs on admin_init, before headers sent) ── function abddir_handle_directory_actions() { if ( ! current_user_can('manage_options') ) return; if ( ! isset($_GET['page']) || $_GET['page'] !== 'abddir-dashboard' ) return; // Create new directory if ( isset($_POST['abddir_create_directory']) ) { check_admin_referer('abddir_create_directory_nonce'); $name = sanitize_text_field( wp_unslash( $_POST['dir_name'] ?? '' ) ); $type = sanitize_text_field( wp_unslash( $_POST['dir_type'] ?? 'business' ) ); if ( $name ) { $id = abddir_create_directory( $name, $type ); if ( ! is_wp_error($id) ) { wp_safe_redirect( add_query_arg([ 'page' => 'abddir-dashboard', 'view' => 'dir', 'dir_id' => $id, 'tab' => 'settings', 'created' => 1, ], admin_url('admin.php') ) ); exit; } } } // Delete directory if ( isset($_GET['abddir_delete_dir']) ) { $dir_id = intval( $_GET['abddir_delete_dir'] ); check_admin_referer('abddir_delete_dir_' . $dir_id); if ( get_post_type( $dir_id ) !== 'abddir_directory' ) { wp_die( 'Invalid directory.' ); } abddir_delete_directory_and_listings( $dir_id ); wp_safe_redirect( add_query_arg([ 'page' => 'abddir-dashboard', 'deleted' => 1, ], admin_url('admin.php') ) ); exit; } // Save directory settings if ( isset($_POST['abddir_save_dir_settings']) ) { $dir_id = intval( $_POST['dir_id'] ?? 0 ); check_admin_referer('abddir_dir_settings_nonce_' . $dir_id); if ( $dir_id && get_post_type( $dir_id ) === 'abddir_directory' ) { // Update post title (directory name) $new_name = sanitize_text_field( wp_unslash( $_POST['dir_name'] ?? '' ) ); if ( $new_name ) { wp_update_post([ 'ID' => $dir_id, 'post_title' => $new_name, ]); } abddir_save_directory_settings( $dir_id, $_POST ); wp_safe_redirect( add_query_arg([ 'page' => 'abddir-dashboard', 'view' => 'dir', 'dir_id' => $dir_id, 'tab' => 'settings', 'saved' => 1, ], admin_url('admin.php') ) ); exit; } } // Purge orphaned listings (no directory assigned) if ( isset($_GET['abddir_purge_orphaned']) ) { check_admin_referer('abddir_purge_orphaned'); $orphans = get_posts([ 'post_type' => 'abddir_listing', 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', 'meta_query' => [[ 'key' => 'abddir_directory_id', 'compare' => 'NOT EXISTS', ]], ]); $count = 0; foreach ( $orphans as $lid ) { wp_delete_post( $lid, true ); $count++; } wp_safe_redirect( add_query_arg([ 'page' => 'abddir-dashboard', 'purged' => $count, ], admin_url('admin.php') ) ); exit; } // Reassign stray listings (point to a deleted/invalid directory) to a valid directory if ( isset($_GET['abddir_reassign_stray']) ) { $target_dir = intval( $_GET['abddir_reassign_stray'] ); check_admin_referer('abddir_reassign_stray_' . $target_dir); // Get all valid directory IDs $valid_ids = get_posts([ 'post_type' => 'abddir_directory', 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids', ]); // Target must itself be a valid directory if ( ! in_array( $target_dir, $valid_ids, true ) ) { wp_die( 'Invalid target directory.' ); } // Find listings whose abddir_directory_id is set but not in the valid list $all_listings = get_posts([ 'post_type' => 'abddir_listing', 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', 'meta_query' => [[ 'key' => 'abddir_directory_id', 'compare' => 'EXISTS', ]], ]); $count = 0; foreach ( $all_listings as $lid ) { $current = intval( get_post_meta( $lid, 'abddir_directory_id', true ) ); if ( ! in_array( $current, $valid_ids, true ) ) { update_post_meta( $lid, 'abddir_directory_id', $target_dir ); $count++; } } wp_safe_redirect( add_query_arg([ 'page' => 'abddir-dashboard', 'reassigned' => $count, ], admin_url('admin.php') ) ); exit; } // Delete stray listings (point to a deleted/invalid directory) if ( isset($_GET['abddir_delete_stray']) ) { check_admin_referer('abddir_delete_stray'); $valid_ids = get_posts([ 'post_type' => 'abddir_directory', 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids', ]); $all_listings = get_posts([ 'post_type' => 'abddir_listing', 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', 'meta_query' => [[ 'key' => 'abddir_directory_id', 'compare' => 'EXISTS', ]], ]); $count = 0; foreach ( $all_listings as $lid ) { $current = intval( get_post_meta( $lid, 'abddir_directory_id', true ) ); if ( ! in_array( $current, $valid_ids, true ) ) { wp_delete_post( $lid, true ); $count++; } } wp_safe_redirect( add_query_arg([ 'page' => 'abddir-dashboard', 'stray_deleted' => $count, ], admin_url('admin.php') ) ); exit; } } add_action( 'admin_init', 'abddir_handle_directory_actions' ); // ─── Logo Bar (reusable) ────────────────────────────────────────────────────── function abddir_logo_bar() { ?>
v adlertechnology.com
publish ); ?>

Directory and all its listings have been deleted.

orphaned listing permanently deleted.

stray listing reassigned.

stray listing permanently deleted.

New Directory

📁

No directories yet

Click + Add New Directory to create your first one.

ID ); $count = abddir_get_directory_listing_count( $dir->ID ); $type = $s['type'] ?? 'business'; $sc = '[abddir_directory id="' . $dir->ID . '"]'; $dir_url = add_query_arg([ 'page' => 'abddir-dashboard', 'view' => 'dir', 'dir_id' => $dir->ID ], admin_url('admin.php')); $set_url = add_query_arg([ 'page' => 'abddir-dashboard', 'view' => 'dir', 'dir_id' => $dir->ID, 'tab' => 'settings' ], admin_url('admin.php')); $del_url = wp_nonce_url( add_query_arg([ 'page' => 'abddir-dashboard', 'abddir_delete_dir' => $dir->ID ], admin_url('admin.php')), 'abddir_delete_dir_' . $dir->ID ); $type_icons = [ 'business' => '🏢', 'member' => '👥', 'employee' => '🪪' ]; $icon = $type_icons[ $type ] ?? '📁'; ?>
+ New Directory
'Listings', 'settings' => 'Settings', ]; ?>
← All Directories › post_title); ?> Copy

Settings saved.

Directory created! Configure its settings below, then add listings via the Listings tab.

'abddir_listing', 'post_status' => 'any', 'posts_per_page' => 1, 'fields' => 'ids', 'meta_query' => [[ 'key' => 'abddir_directory_id', 'compare' => 'NOT EXISTS', ]], ]); $orphan_count = $orphan_query->found_posts; if ( $orphan_count > 0 ) : $purge_url = wp_nonce_url( add_query_arg(['page' => 'abddir-dashboard', 'abddir_purge_orphaned' => 1], admin_url('admin.php')), 'abddir_purge_orphaned' ); ?>

listing without a directory assignment.

Delete Orphaned
'abddir_listing', 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', 'meta_query' => [[ 'key' => 'abddir_directory_id', 'compare' => 'EXISTS' ]], ]); $valid_ids = wp_list_pluck( abddir_get_directories(), 'ID' ); foreach ( $all_with_dir as $lid ) { $cid = intval( get_post_meta( $lid, 'abddir_directory_id', true ) ); if ( ! in_array( $cid, $valid_ids, true ) ) $stray_count++; } if ( $stray_count > 0 ) : $reassign_url = wp_nonce_url( add_query_arg(['page'=>'abddir-dashboard','abddir_reassign_stray'=>$dir_id], admin_url('admin.php')), 'abddir_reassign_stray_' . $dir_id ); $delete_stray_url = wp_nonce_url( add_query_arg(['page'=>'abddir-dashboard','abddir_delete_stray'=>1], admin_url('admin.php')), 'abddir_delete_stray' ); ?>

listing point to a deleted or invalid directory and need to be cleaned up.

Delete Stray Listing Reassign to First Directory
'abddir_listing', 'post_status' => 'publish', 'posts_per_page' => $per_pg, 'paged' => $paged, 'orderby' => 'title', 'order' => 'ASC', 'meta_query' => [[ 'key' => 'abddir_directory_id', 'value' => $dir_id, ]], ]; if ( $search ) $args['s'] = $search; $tax_query = []; if ( $cat ) $tax_query[] = [ 'taxonomy' => 'abddir_category', 'field' => 'slug', 'terms' => $cat ]; if ( $city_f ) $tax_query[] = [ 'taxonomy' => 'abddir_city', 'field' => 'slug', 'terms' => $city_f ]; if ( ! empty($tax_query) ) $args['tax_query'] = $tax_query; $query = new WP_Query($args); $total = $query->found_posts; $total_pages = $query->max_num_pages; $categories = get_terms(['taxonomy' => 'abddir_category', 'hide_empty' => false]); $cities = get_terms(['taxonomy' => 'abddir_city', 'hide_empty' => false]); $type = $s['type'] ?? 'business'; // Column headers per directory type $name_col = ( $type === 'business' ) ? 'Business Name' : 'Name'; ?>
listing + Add Listing
Clear
have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); $pid = get_the_ID(); $phone = get_post_meta($pid, 'abddir_phone', true); $email = get_post_meta($pid, 'abddir_email', true); $website = get_post_meta($pid, 'abddir_website', true); $cats_t = wp_get_post_terms($pid, 'abddir_category', ['fields' => 'names']); $cities_t = wp_get_post_terms($pid, 'abddir_city', ['fields' => 'names']); $abddir_logo = get_post_meta($pid, 'abddir_logo', true); if ( $abddir_logo && is_numeric($abddir_logo) ) { $thumb = wp_get_attachment_image_url( intval($abddir_logo), 'thumbnail' ) ?: ''; } elseif ( $abddir_logo ) { $thumb = $abddir_logo; } else { $thumb = get_the_post_thumbnail_url($pid, 'thumbnail') ?: ''; } ?>
Logo Category City Phone Email Website Actions
— Visit'; ?> Edit Del
No listings yet. Click + Add Listing to add your first one.
1 ) : $base = add_query_arg(['page'=>'abddir-dashboard','view'=>'dir','dir_id'=>$dir_id,'tab'=>'listings'], admin_url('admin.php')); ?>
$base . '&paged=%#%', 'format' => '', 'current' => $paged, 'total' => $total_pages, ]); ?>

Directory Identity

Directory Name
Directory Type
Shortcode [abddir_directory id=""]

Place this shortcode on any page to display this directory.


Display Settings

Default Layout
Cards Per Row (Grid)
Listings Per Page
Card Style
Show Search Bar />
Address Format

Choose International if your directory includes listings outside the US. Adds a Country field to each listing.

Adler Business Directory Pro

Everything in the free plugin, plus the power features organizations ask for most.

Get Pro See Pricing

Every Pro plan includes a full year of updates and priority support. New to the plugin? Get started here.

Documentation

Everything you need to set up and manage your Adler Business Directory.

🚀

Getting Started

▾
  1. Create a Directory — Go to Business Directory in the admin menu and click + Add New Directory. Give it a name and choose a type (Business, Member/Group, or Employee). Create as many directories as you need.
  2. Add Listings — Open a directory and click + Add Listing, then fill in the contact details, description, and social links.
  3. Place the Shortcode — Copy the shortcode from the directory card (e.g. [abddir_directory id="1"]) and paste it into any page or post.
  4. Configure Display — In each directory's Settings tab, choose its layout, cards per row, and card style.
🗂️

Directory Types

▾

Choose the directory type in the Settings tab. Each type adapts the fields, labels, and display to match your use case.

TypeBest ForKey Differences
🏢 Business Local businesses, service providers, vendor lists Business-oriented labels; Website URL in contact info; contact name shown on cards
👥 Member / Group HOAs, clubs, associations, community groups, residents People-oriented labels; Website URL moved to Social Media; Community/Township field available
🪪 Employee Staff directories, org charts, team pages People-oriented labels; Job Title field displayed in the listings table

💡 Tip: The directory type affects which fields appear on listing edit screens and how listings display on the public page.

[ ]

Shortcodes

▾

Place any directory on any page with a shortcode:

[abddir_directory id="1"]

Replace 1 with your directory's ID (shown on each directory card and in the Settings tab).

Available Attributes

AttributeDefaultDescription
idfirst directoryDirectory ID to display
layoutfrom settingsgrid or list
per_pagefrom settingsNumber of listings per page

Example with overrides:

[abddir_directory id="2" layout="list" per_page="20"]
❓

FAQ

▾

Can I have more than one directory?

Yes — create as many directories as you need from the Directories page. Each has its own settings, listings, and shortcode, and you can even place multiple directories on the same page.

Can I place the directory on more than one page?

Yes — the shortcode works on any page or post, and you can use it on several pages at once.

How do visitors search the directory?

The search bar above the listings searches names live as visitors type. You can hide it in the Settings tab if you prefer a static list.

How do I change the order of listings?

Listings display alphabetically by name.

Can I organize listings with categories?

Yes — assign categories on the listing edit screen (right-hand panel), then filter by category in the admin Listings tab. You can also show a single category on a page with [abddir_directory category="your-category"].

The "← Back to Listings" button on my listing edit screen — where does it go?

It takes you back to your directory's Listings tab.

Where can I get features like CSV import, filters, maps, and private directories?

Those are part of Adler Business Directory Pro.

Support

We're here to help. Choose the best option below.

📖

Documentation

Step-by-step guides covering setup, listings, shortcodes, and more.

Browse Documentation
🎫

Submit a Support Ticket

Have a question or found a bug? Send us a message and we'll respond within 1 business day.

Email Support
🌐

Adler Technology

Visit our website for news, updates, and additional plugins and tools for your WordPress site.

Visit adlertechnology.com

Common Issues

⚠️

Directory shows "0 listings"

▸
⚠️

Changes don't appear on the front end

▸