Ele Ajax Search
Ele Ajax Search is a lightweight AJAX search widget for Elementor with real-time results, autocomplete, and support for posts, pages, and custom post types. It’s fully customizable, mobile-friendly, and performance optimized for fast, seamless WordPress search without page reloads.
by Ali Nawaz · github.com/bealinawaz/ele-ajax-search · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/bealinawaz/ele-ajax-search/archive/refs/heads/main.zipEle Ajax Search - Elementor Widget Plugin
A professional, optimized AJAX search widget for Elementor with autocomplete functionality and extensive customization options.
Features
✅ Real-time AJAX Search - Instant search results without page reload
✅ Autocomplete Support - Live suggestions as users type
✅ Multiple Post Types - Search posts, pages, or custom post types
✅ Configurable Results - Control number of results displayed
✅ Featured Images - Optional post thumbnails in results
✅ Loading Indicator - Optional spinner for better UX
✅ Fully Customizable - Extensive styling controls for every element
✅ Responsive Design - Mobile-friendly out of the box
✅ Keyboard Navigation - Arrow keys and Enter support
✅ Security Focused - Nonce verification and data sanitization
✅ Performance Optimized - Debounced requests and efficient queries
✅ Best Practices - Follows WordPress and Elementor coding standards
Requirements
- WordPress 5.8 or higher
- PHP 7.4 or higher
- Elementor 3.0.0 or higher
Installation
Method 1: Manual Installation
- Download all plugin files
- Create the following folder structure in
wp-content/plugins/:
ele-ajax-search/
├── ele-ajax-search.php
├── widgets/
│ └── ajax-search-widget.php
├── assets/
│ ├── css/
│ │ └── ele-ajax-search.css
│ └── js/
│ └── ele-ajax-search.js
└── languages/
-
Place the files in their respective folders:
- Main plugin file:
ele-ajax-search.phpin the root - Widget class:
ajax-search-widget.phpinwidgets/folder - CSS file:
ele-ajax-search.cssinassets/css/folder - JS file:
ele-ajax-search.jsinassets/js/folder
- Main plugin file:
-
Go to WordPress Admin → Plugins
-
Find "Ele Ajax Search" and click "Activate"
Method 2: Upload ZIP
- Create a ZIP file of the
ele-ajax-searchfolder - Go to WordPress Admin → Plugins → Add New
- Click "Upload Plugin"
- Choose the ZIP file and click "Install Now"
- Click "Activate Plugin"
Usage
Adding the Widget
- Edit a page with Elementor
- Search for "Ajax Search" in the widgets panel
- Drag the widget to your desired location
- Configure the settings in the left panel
Widget Controls
Content Tab
- Placeholder Text: Text shown in the empty search box
- Post Type: Select which post type to search (posts, pages, custom post types)
- Number of Results: How many results to display (1-20)
- Enable Autocomplete: Toggle live search suggestions
- Show Featured Image: Display post thumbnails in results
- No Results Text: Message shown when no results found
- Show Loading Icon: Display spinner during search
Style Tab
The plugin includes extensive styling options:
- Search Box: Width, padding, typography, colors, borders, shadows
- Results Container: Background, borders, shadows, max height
- Result Item: Padding, spacing, hover effects, borders
- Result Title: Typography, colors, hover states
- Result Image: Size, spacing, border radius
- Loading Icon: Color and size
Customization
Modifying Search Query
You can filter the search query using the following hook:
add_filter('ele_ajax_search_query_args', function($args, $settings) {
// Modify query arguments
$args['posts_per_page'] = 10;
return $args;
}, 10, 2);
Custom Result Template
To customize the result item HTML, modify the buildResultItem function in ele-ajax-search.js.
Additional Styling
Add custom CSS in your theme or child theme:
/* Custom styling */
.eas-search-container {
/* Your custom styles */
}
Features Explained
Autocomplete
When enabled, search results appear automatically as users type (after 2 characters minimum). The search is debounced by 300ms to prevent excessive requests.
Keyboard Navigation
- Down Arrow: Move to next result
- Up Arrow: Move to previous result
- Enter: Navigate to selected result
- Escape: Close results dropdown
Security
- AJAX requests use WordPress nonces for verification
- All user input is sanitized
- Output is escaped to prevent XSS attacks
- Follows WordPress security best practices
Performance
- Query optimization (disabled unnecessary meta and term caches)
- Debounced AJAX requests
- Abort previous requests when new search starts
- Efficient DOM manipulation
- No jQuery conflicts
Troubleshooting
Results Not Showing
- Check if JavaScript console shows any errors
- Verify Elementor is activated
- Clear browser and WordPress cache
- Check if the selected post type has published posts
Styling Issues
- Check for theme CSS conflicts
- Use browser inspector to identify conflicting styles
- Increase CSS specificity if needed
- Clear cache after style changes
AJAX Not Working
- Verify WordPress AJAX URL is correct
- Check browser console for 403/404 errors
- Disable other plugins to check for conflicts
- Check server error logs
Browser Support
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers (iOS Safari, Chrome Android)
Performance Recommendations
- Use a caching plugin (W3 Total Cache, WP Rocket)
- Limit the number of results to improve load time
- Optimize images used in search results
- Use a CDN for better global performance
Developer Notes
Code Structure
The plugin follows object-oriented programming principles:
- Main plugin class handles initialization and registration
- Widget class extends Elementor's base widget class
- JavaScript uses a class-based approach for better organization
Coding Standards
- Follows WordPress Coding Standards
- Uses Elementor's best practices
- Proper documentation and comments
- Secure and optimized code
Hooks Available
ele_ajax_search_query_args- Filter search query arguments- Standard WordPress hooks apply (pre_get_posts, etc.)
Support
For issues or feature requests, please:
- Check the troubleshooting section
- Review the code comments for guidance
- Test with default WordPress theme and no other plugins
Changelog
Version 1.0.0
- Initial release
- AJAX search with autocomplete
- Multiple post type support
- Extensive customization options
- Responsive design
- Keyboard navigation
- Security and performance optimizations
Credits
Developed following WordPress and Elementor best practices and coding standards.
License
GPL v2 or later
Note: This plugin requires Elementor to be installed and activated. It will not work without Elementor.