WP Meta Sort Posts WordPress Plugin
I initially developed WP Meta Sort Posts plugin because I needed to be able to create archive-style pages for posts based on custom fields. I quickly realized that it would be just as easy to knock down all the walls and allow for custom sorted pages to be created based on any combination of WordPress query variables. WP Meta Sort Posts is still in its initial beta release and I welcome all feedback and feature suggestions. If you would like to participate in development I will be managing the project through Github.com.
- Download the “.zip” file and upload the wp-meta-sort-posts folder and its contents to your WordPress /wp-content/plugins directory.
- Visit your WordPress Admin Dashboard and activate WP Meta Sort Posts in the “Plugins” menu.
- Set the plugin options in the Admin Dashboard “Settings” menu under “WP Meta Sort Posts Options.”
WP Meta Sort Posts Plugin Options
Theme’s loop file
The best way to mimic your theme’s look and feel is to use your theme’s original loop to present the posts. Not all themes will have its loop broken out. If it is, you can enter the name of the file excluding the “.php” file extension in the WP Meta Sort Posts options page under “Settings” in your WordPress admin dashboard. In some cases your themes loop file will actually be called “loop.php,” however, it is not a strict standard and can be named anything. For an example of what a loop file will look like, see The Loop.
If your theme does not have have a loop file, you can use the basic loop built into the plugin. Right now the included loop is very basic, but it works. Adding more robust configuration options to the included loop is the top priority for a future release.
If you would like help identifying the best options for your theme, please leave a request in the comments below.
Page Navigation Location
Top. Sets the page navigation above the list of posts.
Bottom. Sets the page navigation below the list of posts.
Both. Sets the page navigation above and below the list of posts.
None. Does not include page navigation. This option is used when the theme’s loop file already includes navigation.
WP Meta Sort Posts Plugin Shortcode Usage
Create a new page and include a shortcode in the following format:
“QUERY” in the above example refers to a complete query in URL Query String format. Both public and private WordPress query variables can be passed as long as it is formatted appropriately, e.g.
Notes: Do not URL Encode special characters like spaces to %20. Do not use query variables “paged” and “offset” in your shortcode because they are automatically calculated and added to the query string.
If you prefer, you can also pass each argument separately, e.g.
[msp Argument1=”Value1” Argument2=”Value2” Argument3=”Value3”]
The same query will be performed as in the first example if the arguments are passed like this.
[msp meta_key="msp_test" meta_value="Arizona" orderby="meta_value" order="asc"]
This plugin was initially developed for HeatMap Theme Pro, but also includes preconfigured options for Twenty Ten and can be used with any theme by setting the theme’s loop file option to “MSP” in order to use the provided loop. As I receive requests for help with specific themes I will add support for those in future releases of the plugin and will add them to the following list.