Description
THIS PLUGIN IS IN HEAVY DEVELOPMENT!
Extend your site’s querying and sorting functionality using custom field values.
The following function registers queryable fields.
register_custom_queryable_field($fieldName, $options);
Simple Example:
register_custom_queryable_field(โcityโ);
(The above registers the custom field โcityโ to be searchable using query variables)
http://www.yoursite.com/?city=Anahiem
(displays posts which have a meta key โcityโ and a value of โAnahiemโ)
Advanced Example:
register_custom_queryable_field(โpriceโ, array(โdataTypeโ=>โnumericโ));
(The above registers the custom field โpriceโ to be searchable as a number using query variables)
http://www.yoursite.com/?price=500
(displays posts which have a meta key โpriceโ and a exact value of โ500โ)
http://www.yoursite.com/?price_min=200&price_max=800&order_by=price
(displays posts, sorted by โpriceโ, which have a meta key โpriceโ and a value between โ200โ and โ800โ)
Available Options:
- dataType
- text (default)
- numeric (receive min/max query variables, see above example)
- order
- If the user uses the โorder_byโ query variable then this option determines the order. Available options are โASCโ and โDESCโ(default)
- compare
- Compare method for text types. Defaults to โ=โ. Recommend โLIKEโ
There is a โorder_byโ query var made available. This is used by adding &order_by=price
to the URL. In this instance, the query would sort based on the โpriceโ field only.
Note: This plugin does not alter any queries when in the backend.
Installation
- Upload
custom-query-fields
directory to the/wp-content/plugins/
directory - Activate the plugin through the โPluginsโ menu in WordPress
- See Description on how to enable the custom variables.
FAQ
- When will you have some FAQ’s?
-
Soon.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Custom Query Fields” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Custom Query Fields” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
0.1.2b
- Fixed some foreach bugs that threw warnings if no fields were registered.
- The plugin is now only using one global variable.
- Added backward compatibility with version 3.0.
- Improved code efficiency.
- Added enable and disable functions to allow you to apply custom field query to external query’s.
0.1.1b
- Added the ability to control whether the query altering function is run only once.
- Added the compare option to the registered fields. This compare is ignored for numeric comparisons.
0.1b
- Initial build.