Customize Listdom
Customize Listdom plugin: map, map marker, category, pagination, etc.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/chidang/listdom-customize/archive/refs/heads/master.zipListdom Customize Plugin
This plugin customizes the Listdom plugin to use proper WordPress taxonomy relationships instead of custom meta fields for categories.
Changes Made
Removed Meta Field Usage
- Before: Used
_listdom_categoriesmeta field to store category IDs - After: Uses proper WordPress taxonomy relationship between
listdom-listingpost type andlistdom-categorytaxonomy
Updated Functions
get_listdom_categories()- Now useswp_get_object_terms()instead ofget_post_meta()get_listdom_category_names()- Now useswp_get_object_terms()with 'names' fieldsave_listdom_categories()- Now only useswp_set_object_terms()instead of storing metarender_listdom_category_meta_box()- Now reads existing categories using taxonomy
Benefits
- Better Performance: WordPress taxonomy queries are optimized
- Standard WordPress Practice: Uses built-in taxonomy functionality
- Better Integration: Works seamlessly with WordPress core features
- Cleaner Data: No duplicate data storage
Migration
The plugin includes a migration script that will:
- Find all posts with
_listdom_categoriesmeta - Migrate the data to proper taxonomy relationships
- Clean up the old meta fields
How to Run Migration
- Go to Listdom Listings > Migrate Categories in your WordPress admin
- Click "Run Migration" to start the process
- The script will show you the results of the migration
After Migration
Once the migration is complete, you can:
- Delete the
migrate-categories.phpfile (optional) - Remove the migration include line from
listdom-customize.php
Usage
The helper functions work the same way as before:
// Get category IDs
$category_ids = get_listdom_categories($post_id);
// Get category names
$category_names = get_listdom_category_names($post_id);
// Display categories
echo display_listdom_categories($post_id, ', ');
Admin Interface
The admin interface remains the same - you can still select multiple categories using the Select2 dropdown in the meta box on listdom-listing posts.
Auto-Search Functionality
The plugin automatically triggers search when category selection changes:
- Admin: When categories are selected/deselected in the admin meta box, search is automatically triggered
- Frontend: When users change category selection on the frontend, search is automatically triggered
- Dynamic Content: Works with dynamically loaded content and Select2 dropdowns
- Multiple Search Buttons: Automatically finds and triggers the appropriate search button
How It Works
- Event Detection: Monitors changes to elements with class
.listdom-category - Search Button Detection: Automatically finds search buttons using various selectors
- Auto-Trigger: Triggers the search button click event after a small delay
- Cross-Platform: Works with both regular select elements and Select2 dropdowns
Map Marker Customization
The plugin also customizes map markers to use your logo instead of category icons:
- Custom Logo: Map markers now display your logo (
assets/images/icon-logo.png) instead of category icons - Consistent Branding: All map markers use the same logo for consistent branding
- Proper Styling: Custom CSS ensures the logo displays properly on both Google Maps and Leaflet maps
Logo Requirements
- Place your logo at
assets/images/icon-logo.png - Recommended size: 28x28 pixels or larger (will be scaled down)
- PNG format recommended for transparency support
Compatibility
This change maintains backward compatibility with existing code that uses the helper functions, but now uses the proper WordPress taxonomy system under the hood.