wpengine / atlas-content-modeler

Content modeling plugin for WordPress
https://developers.wpengine.com/docs/atlas-content-modeler
GNU General Public License v2.0
165 stars 13 forks source link

Add filter support for ACM models #229

Closed dipankarmaikap closed 2 years ago

dipankarmaikap commented 3 years ago

Is your feature request related to a problem? Please describe.

Currently there is really no option available for filter for the models created.

  1. ACM now supports taxonomies which is a great feature but there is no way to filter by taxonomies.
  2. As ACM does not offer option for slug yet cant filter by this either. (Technically its possible but its not user friendly)
  3. Does not support filter by author.

Describe the solution you'd like

In wp graphql its offers all the above mentions option for all the native post types, Something similar.

Describe alternatives you've considered

There is really no real alternative for this one thing would be to fetch all the data and then filter in the front-end.

mindctrl commented 3 years ago

Thanks @dipankarmaikap! We'll look into this.

Internal note: we're tracking this in Jira under BH-1190.

mindctrl commented 3 years ago

@dipankarmaikap just noting that it's possible to query by author now. Taxonomy filtering is coming in the near future. We'll update you here when that's available.

nickcernis commented 2 years ago

Work in progress on documenting taxonomy queries/filtering: https://github.com/wpengine/headless-docs/pull/104

Internal link for our reference: https://wpengine.atlassian.net/browse/MTKA-1310

nickcernis commented 2 years ago

ACM now supports filtering by taxonomy, slug and author as requested.

Upgrade to the latest version of ACM, then you can:

Fetch posts by taxonomy

  1. Install the WPGraphQL Tax Query plugin.
  2. See our taxonomy query guide for example queries.

Fetch a post by slug

  1. Enable slugs for your post type in the Screen Options when editing any post:
Screenshot showing the “slug” checkbox ticked in the Screen Options area.
  1. Enter a slug for your entry in the sidebar, such as "custom".

  2. Use this query to fetch a post by its slug (for a model named "rabbit"):

{
  rabbitBy(slug: "custom") {
    title
  }
}

Fetch posts by author

  1. Change the author from the post sidebar if needed.

  2. Use this query to fetch entries by author (for a model named 'rabbits'):

{
  rabbits(where: {authorName: "local"}) {
    edges {
      node {
        title
      }
    }
  }
}