Mai Post Grid & Mai Term Grid Blocks

An extremely powerful set of blocks to display a grid of post or term entries in various layouts.

Mai Post Grid walk-through video

Mai Term Grid walk-through video

Mai Post Grid and Mai Term Grid block examples

All Mai Grid blocks have the same tabs of settings. The only difference between each is the “Entries” tab, which is the “query” used to pull in the entries you want to display in the grid.

Display & Layout

The Display settings are for choosing which entry elements should display, in what order they should display, and the display of the elements inside each entry.

The Layout settings are for setting the layout of the actual entries in the container/row(s); including the amount of columns, the alignment of the columns, and the gap/gutter between the entries.

Mai Grid blocks share nearly identical settings and functionality with the theme Content Archive settings in the Customizer. For a description of the available settings, see the  Content Archives article in our docs.

Mai Post Grid – Entries

By default, Mai Post Grid is set to show 12 recent posts, similar to a regular blog, where the are ordered newest to oldest. Our custom block gives you nearly endless possibilities of which entries to display. We’ll break it down below.

Post Type

Display entries from one or more post types, including any public or publicly_queryable custom post types.

Get Entries By

This setting tells the query “how” to get the entries.

Choices:

  • Default Query (by date)
  • Choice
  • Taxonomy/Meta

Default Query

The default query just gets all entries, and the Order and Order By settings determine what will display.

Choice

Getting entries by Choice will display a Choose Entries field where you can choose specific entries to display.

Taxonomy/Meta

Getting entries by Taxonomy or Post Meta allows you to get entries in (or not in) a specific category, tag, custom taxonomy term, or with/without specific post meta values.

The Use current setting will display entries in the same category/term as the post or archive you are current viewing. This is great for “Related Posts” in the After Entry template part, or “Featured Posts” via Mai Display Taxonomy and Mai Archive Pages plugins on category/term archives.

You can build multiple conditions/rules, which makes Mai Grid blocks some of the most powerful blocks available.

This following example shows how to get posts that are IN the Recipes category and NOT tagged Dairy Free.

Taxonomies Relation

This setting determines the relation between 2 or more conditions. In the example above, having a taxonomy relation of And means, “in the Recipes category AND ALSO not tagged Dairy Free”.

Change this to Or would mean, “in the Recipes category OR tagged Dairy Free”.

Parent

The parent settings are meant hierarchical post types like Pages. You can set the parent page and show only child pages of itself. Or, you can check the box to “ Show children of current entry” to do just that, show child pages of the page you are currently on.

The Parent settings are great for Services, Practice Areas, Our Team, etc. pages.

  1. Create a WordPress Page called “Services” (or whatever you want it to be) if you don’t already have one.
  2. Create a child page for each service by setting the “Services” page as the parent page via the Page Attributes metabox in the sidebar when creating/editing each page.
  3. Add a Mai Post Grid block to the Services page.
  4. Set “Get Entries By” to “Parent”.
  5. Check the box to “Show children of current entry”, or choose the “Services” page as the Parent page to display children of.

Number of Entries

The number of entries to display in the grid. Default is typically 12. Use 0 (zero) or a really high number like 500 to show all.

Offset

The number of entries to skip. Example: If you are getting the 12 most recent posts, setting the offset to 2 will mean, “get the 12 most recent posts, skipping the 2 most recent”. Or in other words, “get the 12 most recent posts, starting from the 3rd.

The offset setting is most useful when you have multiple grid blocks on the same page, for the goal of different layouts. You can use 2 Mai Grid blocks in a Columns block. The left can show your most recent post really big, filling the full column, then the right column can show a list of 4-6 of recent posts. Set the offset to 1 so it “skips” the one already displayed via the first column.

You can also use the "Exclude displayed" setting below instead of offset for this scenario.

After Date

Get posts after a specific duration of time.

Before Date

Get posts before a specific duration of time.

Date fields accept any human readable text that strtotime() accepts.

Order By

Order the entries by different options.

  • Title – Alphabetically by the entry title.
  • Slug – Alphabetically by the entry slug/permalink.
  • Date – The entry date.
  • Modified – The entry’s last modified date.
  • Random – Shows random entries every page load (the “random” query may be disabled on some hosts).
  • Comment Count – The amount of comments each entry has.
  • Menu Order – The order in the main entry list in the back end. Works really well with Simple Page Ordering plugin.
  • Meta Value Number – (Advanced!) Order by numeric meta value. When using this option, you must put in a meta key to order values by. This is great for ordering posts by total social shares via Shared Counts plugin, using shared_counts_total meta key.

Order

Whether the Order By setting should display Ascending or Descending entries.

Exclude Entries

Exclude specific entries from being displayed. This setting allows you to use all the other settings to get the entries you want, then easily exclude one ore more specific entries.

If you want to exclude a lot of entries you should consider getting entries by “Taxonomy/Meta” and excluding by tag, category, or custom taxonomy.

Exclude

Exclude Displayed

Exclude entries that are already displayed by other instances of Mai Grid blocks. Imagine you have a “Recent Posts” section on your homepage showing the latest 6 posts. Lower in the page you may have a “Featured Posts” or “Latest Recipes” section. If you want to easily make sure no posts from the “Recent Posts” section display in these sections, just check this “Exclude displayed” box.

Exclude Current

Exclude the current page/post/entry from being displayed in the grid. This is useful when using Mai Post Grid in the After Entry widget area. Checking the “Exclude current” box makes sure the grid never shows the actual post you are on inside of the grid.


Mai Term Grid – Entries

By default, Mai Term Grid is set to show 12 recent categories, where the are ordered newest to oldest. Our custom block gives you nearly endless possibilities of which entries to display. We’ll break it down below.

All of the settings in this tab give a UI to create a query that gets used by WP_Tax_Query.

Taxonomy

Display entries from one or more taxonomy including categories, tags, and any public custom taxonomies.

Get Entries By

This setting tells the query “how” to get the entries.

Taxonomy

The default query just gets all entries, and the Order and Order By settings determine what will display.

Choice

Getting entries by Choice will display a "Choose Entries" field where you can choose specific entries to display.

Parent

The parent setting is great for hierarchical taxonomies like Categories. You can set the parent category/term and show only child terms of itself. Or, you can check the box to “Show children of current entry” to do just that, show child pages of the page you are currently on.

The Parent settings are great for Recipes, Travel Locations, etc.

  1. Create a WordPress Category called “Recipes” (or whatever you want it to be) if you don’t already have one.
  2. Create a child category for each recipe (like Entries, Appetizers, Sides, etc) by setting the “Recipes” category as the parent via the Parent Category select field when creating/editing each category.
  3. Add a Mai Term Grid block to the any page.
  4. Set “Get Entries By” to “Parent”.
  5. Choose the “Recipes” category as the Parent category to display children of.

Number of Entries

The number of entries to display in the grid. Default is typically 12. Use 0 (zero) or a high number like 500 to show all.

Offset

The number of entries to skip. Example: If you are getting the 12 most recent categories, setting the offset to 2 will mean, “get the 12 most recent categories, skipping the 2 most recent”. Or in other words, “get the 12 most recent categories, starting from the 3rd.

Order By

Order the entries by different options.

  • Title – Alphabetically by the entry title.
  • Slug – Alphabetically by the entry slug/permalink.
  • Entry Totals – The total amount of entries each category/term has assigned to it.
  • Term ID – Number order by the term ID stored in the database.

Order

Whether the Order By setting should display Ascending or Descending entries.

Exclude Entries

Exclude specific entries from being displayed. This setting allows you to use all the other settings to get the entries you want, then easily exclude one ore more specific entries.

Exclude

Exclude terms with no posts

Exclude categories/terms that do not have any posts/entries assigned to them. This would prevent someone clicking to go to a term archive that is empty.

Exclude Displayed

Exclude entries that are already displayed by other instances of Mai Grid blocks.

Exclude Current

Exclude the current term from being displayed in the grid. This is useful when using Mai Term Grid in the archive intro text of a category (via Reusable Blocks and [mai_content] shortcode). Checking the “Exclude current” box makes sure the grid never shows the actual term you are on inside of the grid.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us