Assigning posts to an Essential Grid is fairly easy with the ability to choose between post type, categories, and tags.
But if you need to exclude specific posts from the chosen source, this article will cover how this can be accomplished.
Example scenario where you might want to exclude a specific post:
- You wish to include "Category A" and "Tag 1" as the grid’s source.
- "Category A" may or may not contain "Tag 1", and vice versa.
- Posts with "Tag 1" may also contain an additional category named "Category B".
- You wish to exclude posts that have "Category B" assigned.
The easiest way to exclude specific posts from a grid is to use the "post__not_in" Additional Parameter. In the following screenshot, the grid would exclude posts with the ID's "10" and "25"
But if you’d rather not update the “Additional Parameters” value each time you wish to exclude a post, and instead would like to do this from within the post itself, here’s how this can be accomplished:
1. Add the following to the "Additional Parameters" section.
2. Create a new "Custom Meta" with the following settings.
3. Inside the post's "Essential Grid Custom Settings" section, assign the number "1" to your posts that you wish to exclude.
Because the number “0” was designated as the Custom Meta’s default value (see “Custom Meta” screenshot above), this value will automatically be assigned to your other posts. But you may need to visit these posts in your WP admin and click “Update” for the value to be officially assigned.
- Essential Grid Custom Settings -> Custom Meta -> Hidden Item -> 0 = DO NOT exclude post from grid
- Essential Grid Custom Settings -> Custom Meta -> Hidden Item -> 1 = EXCLUDE post from grid