mmirus/display-posts-meta-compare

Add a meta_compare argument to the Display Posts shortcode

1.0.0 2019-01-25 19:49 UTC

This package is auto-updated.

Last update: 2024-10-26 08:31:50 UTC


README

Add a meta_compare argument to the Display Posts shortcode.

You must have the Display Posts plugin installed. Docs for the plugin can be found at https://displayposts.com/.

[display-posts meta_key="my_custom_field" meta_compare="!=" meta_value="a value"]

Possible values for meta_compare are the ones available in a WP_Query: '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'EXISTS', 'NOT EXISTS', 'REGEXP', 'NOT REGEXP', and 'RLIKE'.

I haven't tested many different types of comparison, however, and it's likely that some won't work. Feel free to submit a PR or create an issue if you run into problems.

Installation

There are three options for installing this plugin:

  1. With composer from Packagist: composer require mmirus/display-posts-meta-compare
  2. With GitHub Updater
  3. By downloading the latest release ZIP from this repository and installing it like any normal WordPress plugin

Contributing

To work on this project (for yourself or to contribute a PR):

  1. Clone this repo
  2. Run composer install

And you should be good to go.

Pre-commit linting is enforced (PSR-2 for PHP).