CMB2 Field Type: Ajax Search
CMB2 field type to attach posts, users or terms.
by Tsunoa · github.com/rubengc/cmb2-field-ajax-search · website
★ 34stars
23forks
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/rubengc/cmb2-field-ajax-search/archive/refs/heads/master.zipDeclares an update source (https://github.com/rubengc/cmb2-field-ajax-search), so updates arrive through the plugin's own updater.
From the readme
CMB2 Field Type: Ajax Search
Custom fields for CMB2 to attach posts, users or terms to each others.
Once activated, this plugin adds three new field types postajaxsearch, userajaxsearch and termajaxsearch.
This plugin is an update of CMB2 Field Type: Post Search Ajax by Magina with support to attach posts, users or terms.
Installation
You can install this field type as you would a WordPress plugin:
- Download the plugin
- Place the plugin folder in your /wp-content/plugins/ directory
- Activate the plugin in the Plugin dashboard
Parameters
Options :
- multiple (bool, default = false) : Turn field into a multiple attached objects
- limit (int, default = -1 : single selection) : Limit the number of posts that can be selected (-1 for unlimited)
- sortable (bool, default = false) : Allow selected items to be sort (only if multiple = true)
- queryargs (array) : Query arguments to pass on each request
Query args:
- queryargs accepts same parameters as WPQuery for postajaxsearch
- queryargs accepts same parameters as WPUserQuery for userajaxsearch
- queryargs accepts same parameters as WPTermQuery for termajaxsearch
Examples
Customize results output
You can use cmb{$fieldid}a