GravityView CSS guide
This guide shows the HTML each GravityView layout prints and the CSS classes you can use to style it. The markup comes from GravityView 3.9 with DataTables 3.14, GravityView Maps 3.12 and the DIY Layout 2.6. To add CSS to one View, see Adding custom CSS to your Views.
Container wrapper #
Each View on a page is wrapped in a div with the ID gv-view-{View ID}-{number}. The number counts the copies of that View on the page, so the first copy of View 5 is gv-view-5-1. The wrapper also has a class named after the layout:
| Layout | Wrapper class |
|---|---|
| Table | gv-template-table |
| List | gv-template-list |
| Layout Builder | gv-template-layout-builder |
| DataTables | gv-template-datatables |
| Maps | gv-template-map |
| DIY | None. The DIY layout puts the wrapper ID on the View container, as DIY layout shows. |
Inside the wrapper are the header widget zone, the View container and the footer widget zone:

<div id="gv-view-5-1" class="gv-template-table">
<div class="gv-grid gv-widgets-header">…</div>
<div class="gv-table-view gv-table-container gv-table-multiple-container gv-container gv-container-5">
…
</div>
<div class="gv-grid gv-widgets-footer">…</div>
<input type="hidden" class="gravityview-view-id" value="5">
</div>The View container holds the entries. Each layout’s section below lists its own container classes. Every layout also adds these:
| Class | When it is added |
|---|---|
gv-container | Always. |
gv-container-{View ID} | Always, for example gv-container-5. |
gv-container-no-results | The View has no entries to show. A DataTables View has it in the page’s HTML until the table loads its entries. |
gv-hidden | Hide View data until search is performed is on and nobody has searched yet, or No Entries Behavior is set to Hide the View and there are no entries. |
gv-themed and gv-theme-{theme} | The View uses a theme, for example gv-theme-vantage. See Themes: styling your Views with Legacy or Vantage. |
gv-has-map | The View uses the Maps layout, or has a map widget or a map field. |
| Your own class | The class in the View’s CSS Class setting. |
The View Container <div> explains the container in more detail. To change the wrapper’s HTML or the container’s classes with code, see Container filters.
Entries section #
GravityView 3.5.0 and later wrap the entries of the Table, List, and Layout Builder layouts in a section element inside the View container. DataTables 3.14.0, the DIY Layout 2.6.0, and GravityView Maps 3.11.0 do the same in their layouts. The section is a labeled region, so screen reader users can jump straight to a View’s entries. It appears on the Multiple Entries page only.
| Class | Element | What it is | Since |
|---|---|---|---|
.gv-entries | section | Wraps all entries inside the View container. It also has role="region" and a data-gv-entries attribute set to the View’s anchor ID, for example gv-view-47-1. | 3.5.0 |
.gv-entries-title | h2 | The region’s name, “Results” by default. It also has the screen-reader-text class, so screen readers read it and it stays hidden on screen. | 3.5.0 |
HTML example (List layout):
<div class="gv-list-container gv-list-multiple-container gv-container gv-container-22">
<section data-gv-entries="gv-view-22-1" class="gv-entries" role="region" aria-labelledby="gv-view-22-1-entries-label gv-view-22-title">
<h2 id="gv-view-22-1-entries-label" class="gv-entries-title screen-reader-text">Results</h2>
<div id="gv_list_5" class="gv-list-view">...</div>
<div id="gv_list_6" class="gv-list-view">...</div>
</section>
</div>The section is the only element between the View container and the entries. Keep this in mind when you write layout CSS:
- On GravityView 3.5.0 and 3.6.x, a grid or flex rule on the container, such as
.gv-list-multiple-container { display: grid; }, lays out one item (the section), so every entry lands in the first column. Since 3.7.0, the section hasdisplay: contentsin Legacy List, Layout Builder, and DIY Views, so the rule reaches the entries again. With the Vantage theme, the section of a List, Layout Builder, or DIY View is the grid, and the View’s Columns setting sets its columns. How to display GravityView entries in a grid has snippets that work with and without the section. - A child selector such as
.gv-list-multiple-container > .gv-list-viewno longer matches. Use a descendant selector (.gv-list-multiple-container .gv-list-view) or include the section (.gv-list-multiple-container > .gv-entries > .gv-list-view). - The
h2is positioned off screen (position: absolute), so it does not take a cell in a grid on.gv-entries. It is still the section’s first child, so:first-childand:nth-child()count it. Use:first-of-typeand:nth-of-type()to pick entries by position. Leave theh2in place: removing it makes the View harder to use with a screen reader. - In the List, Layout Builder, and DIY layouts, the “No entries” message is inside the section too.
To change the region’s name, use the gk/gravityview/template/entries/label filter. The section is printed by the gk/gravityview/template/entries/before and gk/gravityview/template/entries/after actions.
Table layout #
Multiple entries
The Table layout shows each entry as a table row, with the field labels as column headers.
Class hierarchy:
div#gv-view-{id}-1.gv-template-table
├── div.gv-grid.gv-widgets-header (widget zone)
├── div.gv-table-view.gv-table-container.gv-table-multiple-container.gv-container.gv-container-{id}
│ └── section.gv-entries
│ ├── h2.gv-entries-title.screen-reader-text
│ └── table.gv-table-view
│ ├── caption.screen-reader-text
│ ├── thead > tr > th.gv-field-{form}-{field}
│ ├── tbody > tr > td.gv-field-{form}-{field}
│ └── tfoot > tr > th.gv-field-{form}-{field}
└── div.gv-grid.gv-widgets-footer (widget zone)HTML example:
<div class="gv-table-view gv-table-container gv-table-multiple-container gv-container gv-container-5">
<section data-gv-entries="gv-view-5-1" class="gv-entries" role="region" aria-labelledby="gv-view-5-1-entries-label gv-view-5-title">
<h2 id="gv-view-5-1-entries-label" class="gv-entries-title screen-reader-text">Results</h2>
<table class="gv-table-view">
<caption class="screen-reader-text">Entries</caption>
<thead>
<tr>
<th id="gv-field-1-id" class="gv-field-1-id" scope="col" data-label="Entry ID">
<span class="gv-field-label">Entry ID</span>
</th>
<th id="gv-field-1-1" class="gv-field-1-1" scope="col" data-label="Name">
<span class="gv-field-label">Name</span>
</th>
</tr>
</thead>
<tbody>
<tr class="alt" data-row="0">
<td id="gv-field-1-id" class="gv-field-1-id" data-label="Entry ID">12</td>
<td id="gv-field-1-1" class="gv-field-1-1" data-label="Name">
<a href="/staff/entry/12/">Noah Jensen</a>
</td>
</tr>
<tr class="" data-row="0">
<td id="gv-field-1-id" class="gv-field-1-id" data-label="Entry ID">11</td>
<td id="gv-field-1-1" class="gv-field-1-1" data-label="Name">
<a href="/staff/entry/11/">Fatima Haddad</a>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th id="gv-field-1-id" class="gv-field-1-id" scope="col" data-label="Entry ID">
<span class="gv-field-label">Entry ID</span>
</th>
<th id="gv-field-1-1" class="gv-field-1-1" scope="col" data-label="Name">
<span class="gv-field-label">Name</span>
</th>
</tr>
</tfoot>
</table>
</section>
</div>The rows alternate between class="alt" and an empty class. data-row counts the rows within one entry, so it is 0 on every row of a View with one row per entry.
When the View lets visitors sort by a column, each header label starts with a sort link. The link has no text of its own. Its classes draw the sort icon:
<th id="gv-field-1-1" class="gv-field-1-1" scope="col" data-label="Name">
<span class="gv-field-label">
<a href="/staff/?sort[1]=asc" data-multisort-href="/staff/" class="gv-sort gv-icon-caret-up-down" aria-label="Sort by Name"></a>
Name
</span>
</th>On a View that uses the Vantage theme, the wrapper and the container also have gv-themed and gv-theme-vantage:
<div id="gv-view-5-1" class="gv-themed gv-theme-vantage gv-template-table">
<div class="gv-table-view gv-table-container gv-table-multiple-container gv-container gv-container-5 gv-themed gv-theme-vantage">Vantage’s table styles use .gv-themed table.gv-table-view, so that selector reaches Vantage tables only.
A field’s Custom CSS Class is added to its <th> and to each of its <td> cells, before the gv-field-{form}-{field} class:
<th id="gv-field-1-2" class="keep-one-line gv-field-1-2" scope="col" data-label="Job title">
<td id="gv-field-1-2" class="keep-one-line gv-field-1-2" data-label="Job title">Single entry
The single entry page shows one field per table row, with the label in a <th> and the value in a <td>.
Key differences:
- The container has
gv-table-single-containerin place ofgv-table-multiple-container. - There is no
gv-template-tablewrapper. - The back link is a
navbefore the container. - The table has the class
gv-table-view-content, and each<tr>has the field’s ID and classes.
HTML example:
<nav class="gv-back-link" aria-label="Back to entries">
<a data-viewid="5" href="/staff/">← Go back</a>
</nav>
<div class="gv-table-view gv-table-container gv-table-single-container gv-container gv-container-5">
<table class="gv-table-view-content">
<thead></thead>
<tbody>
<tr id="gv-field-1-1" class="gv-field-1-1">
<th scope="row"><span class="gv-field-label">Name</span></th>
<td>Aiko Tanaka</td>
</tr>
<tr id="gv-field-1-8" class="gv-field-1-8">
<th scope="row"><span class="gv-field-label">Photo</span></th>
<td>
<a class="gravityview-fancybox" href="…/aiko-tanaka.jpg" rel="gv-field-1-8-3">
<img src="…/aiko-tanaka.jpg" alt="Photo" class="gv-image gv-field-id-8">
</a>
</td>
</tr>
</tbody>
<tfoot></tfoot>
</table>
</div>No results state
When there are no entries, the message is in one <td> that spans every column:
<tbody>
<tr>
<td colspan="5" class="gv-no-results gv-no-results-text" role="status">
<p>No entries match your request.</p>
</td>
</tr>
</tbody>When No Entries Behavior is Display a Form, the cell has gv-no-results-form in place of gv-no-results-text and holds the form. The List, Layout Builder and DIY layouts print <div> elements instead, as their sections show.
Table-specific notes
- At 575.98px wide or less,
<thead>and<tfoot>are hidden and each<tr>becomes a block. Each<td>then shows as a row of its own, with itsdata-labelprinted before the value through::before. - The
gravityview/template/table/entry/classfilter changes the class of each<tr>in<tbody>.
List layout #
Multiple entries
The List layout shows each entry as a block with a title, a content area and a footer.
Class hierarchy:
div#gv-view-{id}-1.gv-template-list
├── div.gv-grid.gv-widgets-header (widget zone)
├── div.gv-list-container.gv-list-multiple-container.gv-container.gv-container-{id}
│ └── section.gv-entries
│ ├── h2.gv-entries-title.screen-reader-text
│ └── div#gv_list_{entry ID}.gv-list-view
│ ├── div.gv-list-view-title
│ │ ├── h3.gv-field-{form}-{field}
│ │ └── div.gv-list-view-subtitle > h4
│ ├── div.gv-grid.gv-list-view-content
│ │ ├── div.gv-grid-col-1-3.gv-list-view-content-image
│ │ └── div.gv-grid-col-2-3.gv-list-view-content-description
│ └── div.gv-grid.gv-list-view-footer
│ ├── div.gv-grid-col-1-2.gv-left
│ └── div.gv-grid-col-1-2.gv-right
└── div.gv-grid.gv-widgets-footer (widget zone)HTML example:
<div class="gv-list-container gv-list-multiple-container gv-container gv-container-6">
<section data-gv-entries="gv-view-6-1" class="gv-entries" role="region" aria-labelledby="gv-view-6-1-entries-label gv-view-6-title">
<h2 id="gv-view-6-1-entries-label" class="gv-entries-title screen-reader-text">Results</h2>
<div id="gv_list_12" class="gv-list-view">
<div class="gv-list-view-title">
<h3 class="gv-field-1-1">
<a href="/staff/entry/12/">Noah Jensen</a>
</h3>
<div class="gv-list-view-subtitle">
<h4 id="gv-field-1-2" class="gv-field-1-2">Product designer</h4>
</div>
</div>
<div class="gv-grid gv-list-view-content">
<div class="gv-grid-col-1-3 gv-list-view-content-image">
<div id="gv-field-1-8" class="gv-field-1-8">
<a class="gravityview-fancybox" href="…/noah-jensen.jpg" rel="gv-field-1-8-12">
<img src="…/noah-jensen.jpg" width="250" alt="Photo" class="gv-image gv-field-id-8">
</a>
</div>
</div>
<div class="gv-grid-col-2-3 gv-list-view-content-description">
<div id="gv-field-1-3" class="gv-field-1-3">
<p>Designs the screens and flows of the customer dashboard.</p>
</div>
</div>
</div>
<div class="gv-grid gv-list-view-footer">
<div class="gv-grid-col-1-2 gv-left">
<div id="gv-field-1-4.3" class="gv-field-1-4.3">Copenhagen</div>
</div>
<div class="gv-grid-col-1-2 gv-right">
<div id="gv-field-1-entry_link" class="gv-field-1-entry_link">
<a href="/staff/entry/12/">View profile</a>
</div>
</div>
</div>
</div>
</section>
</div>Single entry
Key differences:
- The container has
gv-list-single-container. - There is no
gv-template-listwrapper. - The back link is a
navand the first thing inside the container. - The title is plain text, without a link.
- The content area has no
gv-gridclass. - There is no footer zone.
- Fields with Show Label on start with
span.gv-field-label.
HTML example:
<div class="gv-list-container gv-list-single-container gv-container gv-container-6">
<nav class="gv-back-link" aria-label="Back to entries">
<a data-viewid="6" href="/staff/">← Go back</a>
</nav>
<div id="gv_list_3" class="gv-list-view">
<div class="gv-list-view-title">
<h3 class="gv-field-1-1">Aiko Tanaka</h3>
<div class="gv-list-view-subtitle">
<h4 id="gv-field-1-2" class="gv-field-1-2">Account executive</h4>
</div>
</div>
<div class="gv-list-view-content">
<div class="gv-list-view-content-image gv-grid-col-1-3">
<div id="gv-field-1-8" class="gv-field-1-8">…</div>
<div id="gv-field-1-4" class="gv-field-1-4">
1-7-1 Konan<br>Minato, Tokyo 108-0075<br>Japan
</div>
</div>
<div class="gv-list-view-content-description">
<div id="gv-field-1-3" class="gv-field-1-3">
<p>Looks after mid-market accounts and runs product demos for new prospects.</p>
</div>
<div id="gv-field-1-6" class="gv-field-1-6">
<span class="gv-field-label">Email</span>
<p><a href="mailto:aiko.tanaka@example.com">aiko.tanaka@example.com</a></p>
</div>
</div>
</div>
</div>
</div>No results state
<div class="gv-list-view gv-no-results gv-no-results-text" role="status">
<div class="gv-list-view-title">
<h3><p>No entries match your request.</p></h3>
</div>
</div>This div is inside the gv-entries section. With Display a Form, it has gv-no-results-form in place of gv-no-results-text.
The gravityview/template/list/entry/class filter changes the class of each entry’s div.
Layout Builder layout #
Multiple entries
The Layout Builder prints the rows and columns you set up in the View editor. Each column is a gv-grid-col-* element with a position class (left, right or none), and each field’s value is in a gv-grid-value element.
Class hierarchy (a row with a two-thirds and a one-third column, then a full-width row):
div#gv-view-{id}-1.gv-template-layout-builder
├── div.gv-grid.gv-widgets-header (widget zone)
├── div.gv-layout-builder-container.gv-layout-builder-multiple-container.gv-container.gv-container-{id}
│ └── section.gv-entries
│ ├── h2.gv-entries-title.screen-reader-text
│ └── div.gv-layout-builder-view.gv-layout-builder-view--entry.gv-grid
│ ├── div.gv-grid-row
│ │ ├── div.gv-grid-col-2-3.left
│ │ │ └── div.gv-field-{form}-{field}
│ │ │ └── div.gv-grid-value
│ │ └── div.gv-grid-col-1-3.right
│ │ └── div.gv-field-{form}-{field}
│ │ └── div.gv-grid-value
│ └── div.gv-grid-row
│ └── div.gv-grid-col-1-1
│ └── div.gv-field-{form}-{field}
│ └── div.gv-grid-value
└── div.gv-grid.gv-widgets-footer (widget zone)HTML example:
<div class="gv-layout-builder-container gv-layout-builder-multiple-container gv-container gv-container-7">
<section data-gv-entries="gv-view-7-1" class="gv-entries" role="region" aria-labelledby="gv-view-7-1-entries-label gv-view-7-title">
<h2 id="gv-view-7-1-entries-label" class="gv-entries-title screen-reader-text">Results</h2>
<div class="gv-layout-builder-view gv-layout-builder-view--entry gv-grid">
<div class="gv-grid-row">
<div class="gv-grid-col-2-3 left">
<div id="gv-field-1-1" class="gv-field-1-1">
<div class="gv-grid-value">
<a href="/staff/entry/12/">Noah Jensen</a>
</div>
</div>
</div>
<div class="gv-grid-col-1-3 right">
<div id="gv-field-1-date_created" class="gv-field-1-date_created">
<div class="gv-grid-value">October 12, 2026</div>
</div>
</div>
</div>
<div class="gv-grid-row">
<div class="gv-grid-col-1-1">
<div id="gv-field-1-4.3" class="gv-field-1-4.3">
<div class="gv-grid-value">Copenhagen</div>
</div>
<div id="gv-field-1-9" class="gv-field-1-9">
<div class="gv-grid-value">Engineering</div>
</div>
</div>
</div>
</div>
</section>
</div>The stylesheet has rules for a gv-featured-entry class, but GravityView does not add it to any entry. To add it, for example to starred entries, use the gravityview/template/layout-builder/entry/class filter.
Single entry
Key differences:
- The container has
gv-layout-builder-single-container. - There is no
gv-template-layout-builderwrapper. - The back link is a
navand the first thing inside the container. - The rows and columns are the ones set up for the single entry page.
- Fields with Show Label on have a
span.gv-field-labelbefore thegv-grid-valueelement.
HTML example (one full-width row):
<div class="gv-layout-builder-container gv-layout-builder-single-container gv-container gv-container-7">
<nav class="gv-back-link" aria-label="Back to entries">
<a data-viewid="7" href="/staff/">← Go back</a>
</nav>
<div class="gv-layout-builder-view gv-layout-builder-view--entry gv-grid">
<div class="gv-grid-row">
<div class="gv-grid-col-1-1">
<div id="gv-field-1-1" class="gv-field-1-1">
<span class="gv-field-label">Name</span>
<div class="gv-grid-value">Aiko Tanaka</div>
</div>
<div id="gv-field-1-9" class="gv-field-1-9">
<span class="gv-field-label">Department</span>
<div class="gv-grid-value">Sales</div>
</div>
</div>
</div>
</div>
</div>No results state
<div class="gv-layout-builder-view gv-no-results">
<div class="gv-layout-builder-view-title">
<h3><p>No entries match your request.</p></h3>
</div>
</div>This div is inside the gv-entries section. The Layout Builder adds no gv-no-results-text or gv-no-results-form class.
The gravityview/template/layout-builder/entry/class filter changes the class of each entry’s div.
DataTables layout #
Multiple entries
The DataTables layout builds on the Table layout with the DataTables JavaScript library. GravityView prints the table, and DataTables then adds its controls around it in the browser, inside a dataTables_wrapper element.
Class hierarchy (after DataTables has loaded):
div#gv-view-{id}-1.gv-template-datatables
├── div.gv-grid.gv-widgets-header (widget zone)
└── div#gv-datatables-{id}.gv-datatables-container.gv-container.gv-container-{id}
└── section.gv-entries
├── h2.gv-entries-title.screen-reader-text
└── div#DataTables_Table_0_wrapper.dataTables_wrapper
├── div.dt-buttons (Buttons setting)
├── div.dataTables_length (page size menu)
├── div.dataTables_processing (the "Loading data…" message)
├── table.gv-datatables.display.dataTable
│ ├── thead > tr > th.gv-field-{form}-{field}.sorting
│ ├── tbody > tr.odd and tr.even > td
│ └── tfoot > tr > th.gv-field-{form}-{field}
├── div.dataTables_info (entry count)
└── div.dataTables_paginate.paging_simple_numbers (page links)HTML example:
<div id="gv-datatables-8" class="gv-datatables-container gv-container gv-container-8">
<section data-gv-entries="gv-view-8-1" class="gv-entries" role="region" aria-labelledby="gv-view-8-1-entries-label gv-view-8-title">
<h2 id="gv-view-8-1-entries-label" class="gv-entries-title screen-reader-text">Results</h2>
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper">
<div class="dt-buttons">
<button class="dt-button buttons-copy buttons-html5" type="button"><span>Copy</span></button>
<button class="dt-button buttons-csv buttons-html5" type="button"><span>CSV</span></button>
<button class="dt-button buttons-excel buttons-html5" type="button"><span>Excel</span></button>
<button class="dt-button buttons-print" type="button"><span>Print</span></button>
<button class="dt-button buttons-collection buttons-colvis" type="button" aria-haspopup="dialog">
<span>Columns</span><span class="dt-down-arrow">▼</span>
</button>
</div>
<div id="DataTables_Table_0_length" class="dataTables_length">
<label>Show <select name="DataTables_Table_0_length">…</select> entries</label>
</div>
<div id="DataTables_Table_0_processing" class="dataTables_processing" role="status" style="display: none;">
<div class="dataTables_processing_text">Loading data…</div>
<div><div></div><div></div><div></div><div></div></div>
</div>
<table id="DataTables_Table_0" data-viewid="8" class="gv-datatables display dataTable">
<thead>
<tr>
<th id="gv-field-1-1" class="gv-field-1-1 sorting sorting_asc" scope="col" aria-sort="ascending">
<span class="gv-field-label">Name</span>
</th>
<th id="gv-field-1-9" class="gv-field-1-9 sorting" scope="col">
<span class="gv-field-label">Department</span>
</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td class="sorting_1" data-row-index="0" data-column-index="0">
<a href="/staff/entry/3/">Aiko Tanaka</a>
</td>
<td data-row-index="0" data-column-index="1">Sales</td>
</tr>
<tr class="even">
<td class="sorting_1" data-row-index="1" data-column-index="0">
<a href="/staff/entry/2/">Daniel Reyes</a>
</td>
<td data-row-index="1" data-column-index="1">Marketing</td>
</tr>
</tbody>
<tfoot>
<tr>
<th id="gv-field-1-1-foot" class="gv-field-1-1" scope="col"><span class="gv-field-label">Name</span></th>
<th id="gv-field-1-9-foot" class="gv-field-1-9" scope="col"><span class="gv-field-label">Department</span></th>
</tr>
</tfoot>
</table>
<div id="DataTables_Table_0_info" class="dataTables_info" role="status" aria-live="polite">Showing 1 to 10 of 12 entries</div>
<div id="DataTables_Table_0_paginate" class="dataTables_paginate paging_simple_numbers">
<a class="paginate_button previous disabled">Previous</a>
<span>
<a class="paginate_button current" aria-current="page">1</a>
<a class="paginate_button">2</a>
</span>
<a class="paginate_button next">Next</a>
</div>
</div>
</section>
</div>When you write selectors for a DataTables View:
- The body cells have no
gv-field-*class. Select a column by its position, for example.gv-datatables tbody td:nth-child(2). A field’s Custom CSS Class is added to its body cells. - DataTables adds
sorting_1to the cells of the column the table is sorted by, andsorting_ascorsorting_descto its header. dataTables_filter, the library’s own search box, appears only when the View has no Search Bar widget.- With the Responsive setting on, the table also has
nowrapanddtr-inline, pluscollapsedwhile columns are hidden, and the first cell of each row hasdtr-control.
Separating GravityView classes from DataTables library classes
| Comes from | Classes |
|---|---|
| GravityView | gv-template-datatables, gv-datatables-container, gv-datatables, gv-field-{form}-{field}, gv-field-label, gv-container, gv-container-{id}, dataTables_processing_text |
| DataTables library | dataTables_wrapper, dataTable, display, sorting, sorting_asc, sorting_desc, sorting_1, odd, even, dataTables_length, dataTables_filter, dataTables_processing, dataTables_info, dataTables_paginate, paging_simple_numbers, paginate_button, current, previous, next, disabled |
| DataTables Responsive extension | nowrap, dtr-inline, collapsed, dtr-control |
| DataTables Buttons extension | dt-buttons, dt-button, buttons-copy, buttons-csv, buttons-excel, buttons-pdf, buttons-print, buttons-html5, buttons-collection, buttons-colvis, dt-down-arrow |
The DataTables styling documentation explains the library’s classes.
Single entry
The single entry page of a DataTables View uses the Table layout’s single entry markup, described in Table layout, with no DataTables markup.
Maps layout #
GravityView Maps adds the Maps layout, which shows a Google Map with the entries, and a map widget and map field for the other layouts.
Maps layout structure
The Maps layout puts the map and the entries in two columns inside the View container. Since GravityView Maps 3.11.0, both columns are inside the gv-entries section. Each entry is a gv-map-view block in the entries column.
Class hierarchy (map above the entries):
div#gv-view-{id}-1.gv-template-map
├── div.gv-grid.gv-widgets-header (widget zone)
├── div.gv-map-container.gv-map-multiple-container.gv-container.gv-grid.gv-container-{id}.gv-has-map
│ └── section.gv-entries
│ ├── h2.gv-entries-title.screen-reader-text
│ ├── div.gv-grid-col-1-1 (map column)
│ │ └── div.gv-map-sticky-container (when the map is sticky)
│ │ └── div#gv-map-canvas-view-{id}.gv-map-canvas.gk-map-canvas.gk-multi-entry-map
│ └── div.gv-grid-col-1-1.gk-map-entries (entries column)
│ └── div#gv_map_{entry ID}.gv-map-view
│ ├── div.gv-grid.gv-map-view-main-attr
│ │ └── div.gv-grid-row
│ │ ├── div.gv-grid-col-1-3.gv-map-view-image
│ │ ├── div.gv-grid-col-1-3.gv-map-view-title > h3
│ │ └── div.gv-grid-col-1-3.gv-map-view-details
│ ├── div.gv-grid.gv-map-view-middle-container
│ │ └── div.gv-grid-row > div.gv-grid-col-1-1.gv-map-view-middle
│ └── div.gv-grid.gv-map-view-footer-container
│ └── div.gv-grid-row > div.gv-grid-col-1-1.gv-map-view-footer
└── div.gv-grid.gv-widgets-footer (widget zone)The Map Position setting decides which column comes first and how wide each one is:
| Map Position | Map column | Entries column |
|---|---|---|
| Top | gv-grid-col-1-1, first | gv-grid-col-1-1 gk-map-entries |
| Bottom | gv-grid-col-1-1, last | gv-grid-col-1-1 |
| Left | gv-grid-col-1-3, first | gv-grid-col-2-3 |
| Right | gv-grid-col-1-3, last | gv-grid-col-2-3 |
To style the entries column in every position, select it by what it holds: .gv-map-multiple-container div:has(> .gv-map-view). How to display GravityView entries in a grid uses this selector to show the entries in columns. It works with and without the gv-entries section.
Map container
In the Maps layout, the map is in its own column inside the View container. As a widget, it is in the widget zone where you placed it. Google Maps draws the map inside it with its JavaScript API.
HTML example (as GravityView prints it):
<div id="gv-map-canvas-view-10"
class="gv-map-canvas gk-map-canvas gk-multi-entry-map"
data-entryid=""
data-gk-map='{"view_id":10,"entry_id":null,"is_multi_entry_map":true,"markers_data":[…]}'
data-gk-map-settings='{"MapOptions":{…},"icon":"…","layers":{…}}'>
</div>While the map loads, the GravityView Maps script adds gk-map-visible, gk-map-markers-generated and gk-map-generated to the canvas.
Single entry
The single entry page of a Maps View has no map column. Its container has gv-map-single-container and gv-map-container, and the entry has a title, a content area and a footer:
div.gv-map-single-container.gv-map-container.gv-container.gv-container-{id}.gv-has-map
├── p.gv-back-link
└── div#gv_map_{entry ID}.gv-map-view
├── div.gv-map-view-title > h3 (and div.gv-map-view-subtitle)
├── div.gv-grid.gv-map-view-content
│ └── div.gv-grid-row
│ ├── div.gv-grid-col-1-3.gv-map-view-image
│ └── div.gv-grid-col-2-3.gv-map-view-description
└── div.gv-grid.gv-map-view-footer
└── div.gv-grid-row
├── div.gv-grid-col-1-2.gv-left
└── div.gv-grid-col-1-2.gv-rightThe back link of a Maps View is a p, where the Table, List and Layout Builder layouts print a nav.
Map widget on other layouts
When a View on another layout, such as Table, has a map widget or map field, the layout keeps its own markup and its View container gets the gv-has-map class:
<div class="gv-table-view gv-table-container gv-table-multiple-container gv-container gv-container-31 gv-has-map">
<section data-gv-entries="gv-view-31-1" class="gv-entries" role="region" aria-labelledby="gv-view-31-1-entries-label gv-view-31-title">
…
</section>
</div>Info window structure
An info window is the popup that opens when a visitor clicks a marker on the map. Its container has one of four modifier classes, set by the info window settings on the View’s Maps tab:
| Modifier class | When |
|---|---|
gv-infowindow-no-image | No image is set for the info window. |
gv-infowindow-full | An image is set and Image Alignment is Top. |
gv-infowindow-left | An image is set and Image Alignment is Left. |
gv-infowindow-right | An image is set and Image Alignment is Right. |
Without an image:
<div class="gv-infowindow-container gv-infowindow-no-image">
<div class="gv-infowindow-content">
<h4><a href="/staff/entry/3/" class="gv-infowindow-entry-link">Aiko Tanaka</a></h4>
<p>1-7-1 Konan, Minato, Tokyo</p>
</div>
</div>With an image:
<div class="gv-infowindow-container gv-infowindow-full">
<div class="gv-infowindow-image">
<img src="…" alt="Aiko Tanaka">
</div>
<div class="gv-infowindow-content">
<h4><a href="/staff/entry/3/" class="gv-infowindow-entry-link">Aiko Tanaka</a></h4>
<p>1-7-1 Konan, Minato, Tokyo</p>
</div>
</div>While the info window loads its content, it holds <div class="gv-infowindow-loading" role="status"></div>.
Geolocation search
The geolocation search field filters entries by distance from an address or from the visitor’s location.
HTML example:
<div class="gv-search-box gk-search-geolocation-field">
<input type="hidden" class="gk-maps-search-current-geolocation-has-search" value="0">
<input type="hidden" class="gk-maps-current-view" value="10">
<input type="hidden" name="lat" class="gk-maps-search-geolocation-lat" value="0" disabled>
<input type="hidden" name="long" class="gk-maps-search-geolocation-lng" value="0" disabled>
<input type="hidden" name="…" class="gk-maps-search-current-geolocation-accuracy" value="0" disabled>
<input type="hidden" name="…" class="gk-maps-search-current-geolocation-flag" value="0" disabled>
<div class="gv-grid-col-1-1">
<label for="search-box-filter_geolocation">Geolocation Radius</label>
</div>
<div class="gv-grid-col-1-1">
<div class="gk-maps-search-geolocation-address-autocomplete-container">
<input type="text" id="gk-autocomplete-filter_geolocation" class="gk-maps-search-geolocation-address-autocomplete"
name="address_search" value="" placeholder="Enter a location">
<button type="button" class="gk-maps-search-current-geolocation" title="Click to use current location">
<svg>…</svg>
</button>
</div>
</div>
<div class="gv-grid-col-1-1">
<div class="gk-maps-search-geolocation-radius-container">
<select name="filter_geolocation" id="search-box-filter_geolocation" class="gk-maps-search-current-geolocation-radius">…</select>
<select name="unit" class="gk-maps-search-current-geolocation-unit">
<option value="km">Kilometers</option>
<option value="mi" selected>Miles</option>
</select>
</div>
</div>
</div>The current-location button also has gk-maps-search-current-geolocation-active while the search uses the visitor’s location. When no radius choices are set, the radius is a number input with the same class. When the View allows one unit only, the unit is a hidden input.
Maps-specific classes
| Class | What it is |
|---|---|
gk-map-canvas | The map canvas. |
gk-multi-entry-map | A map that shows several entries. |
gk-map-visible, gk-map-markers-generated, gk-map-generated | Added by the Maps script as the map loads. |
gv-map-sticky-container | Wraps the map when it stays in view while the page scrolls. |
gk-map-entries | The entries column, when the map is at the top. |
gk-search-geolocation-field | The geolocation search field. |
gk-maps-search-geolocation-address-autocomplete | The address input. |
gk-maps-search-current-geolocation | The current-location button. |
gk-maps-search-current-geolocation-radius | The radius input. |
gk-maps-search-current-geolocation-unit | The unit menu (kilometers or miles). |
gv-infowindow-container, gv-infowindow-image, gv-infowindow-content, gv-infowindow-entry-link | Parts of the info window. |
Classes that start with gm-, such as gm-style and gm-fullscreen-control, come from the Google Maps JavaScript API.
DIY layout #
The DIY layout prints each field with the markup you set for it and adds no labels, rows or columns of its own. See Getting started with the DIY Layout.
Multiple entries
The DIY layout has no gv-template-* wrapper: the View container has the wrapper ID, and the widget zones are before and after it.
Class hierarchy:
div.gv-grid.gv-widgets-header (widget zone)
div#gv-view-{id}-1.gv-diy-container.gv-diy-multiple-container.gv-container.gv-container-{id}
└── section.gv-entries
├── h2.gv-entries-title.screen-reader-text
└── div#gv_diy_{entry ID}.gv-diy-view
└── each field: {Before Output}<div class="gv-field-{form}-{field}">value</div>{After Output}
div.gv-grid.gv-widgets-footer (widget zone)Each field’s Container Tag setting wraps its value. The default is div. Choose None to print the value with no wrapper, or another tag such as p, h2 or blockquote. The wrapper has the field’s Custom CSS Class and its gv-field-{form}-{field} class, with any dot taken out: an Address field’s City (field 4.3) gets gv-field-1-43. Before Output and After Output are printed outside the wrapper.
HTML example:
<div id="gv-view-11-1" class="gv-diy-container gv-diy-multiple-container gv-container gv-container-11">
<section data-gv-entries="gv-view-11-1" class="gv-entries" role="region" aria-labelledby="gv-view-11-1-entries-label gv-view-11-title">
<h2 id="gv-view-11-1-entries-label" class="gv-entries-title screen-reader-text">Results</h2>
<div id="gv_diy_1" class="gv-diy-view">
<div class="gv-field-1-1"><a href="/staff/entry/1/">Maria Okafor</a></div>
<div class="staff-email gv-field-1-6">maria.okafor@example.com</div>
<strong>Phone:</strong><div class="gv-field-1-5">+1 415 555 0142</div><br>
</div>
<div id="gv_diy_2" class="gv-diy-view">
…
</div>
</section>
</div>Single entry
Key differences:
- The back link is a
pbefore the container. - The container and the entry are the same element, with the entry’s ID:
div#gv_diy_{entry ID}.gv-diy-view.gv-diy-container.gv-diy-single-container.gv-container.gv-container-{id}.
HTML example:
<p class="gv-back-link"><a data-viewid="11" href="/staff/">← Go back</a></p>
<div id="gv_diy_3" class="gv-diy-view gv-diy-container gv-diy-single-container gv-container gv-container-11">
<div class="gv-field-1-1">Aiko Tanaka</div>
<div class="staff-email gv-field-1-6">aiko.tanaka@example.com</div>
</div>No results state
<div class="gv-diy-view gv-no-results gv-no-results-text">
<div class="gv-diy-view-title">
<h3><p>No entries match your request.</p></h3>
</div>
</div>In the DIY Layout 2.6.0 and later, this div is inside the gv-entries section, and the View container also gets the gv-container-no-results class.
Available filters
The DIY layout has its own filters for the container and the entry wrapper. They are listed in DIY-specific filters.
Edit Entry #
The Edit Entry page shows the entry’s form, built with Gravity Forms’ own form markup, inside a GravityView wrapper. The classes of the form itself depend on your Gravity Forms version and form theme. The example below comes from Gravity Forms 3.2 with the Orbital form theme.
Complete structure
<div id="gv-view-5-edit-1" class="gv-edit-entry-wrapper gv-container gv-container-5">
<h2 class="gv-edit-entry-title">
<span>Edit Entry</span>
</h2>
<div class="gv-notice">Entry Updated. <a href="/staff/entry/2/">Return to Entry</a></div>
<div id="gform_wrapper_1" class="gform_wrapper gform-theme …">
<form method="post" id="gform_1" enctype="multipart/form-data" action="…">
<input type="hidden" id="is_gv_edit_entry" name="is_gv_edit_entry" value="…">
<div class="gform-body gform_body">
<div id="gform_fields_1" class="gform_fields top_label …">
<!-- One div.gfield or fieldset.gfield per field -->
</div>
</div>
<div class="gform-footer gform_footer top_label">
<div id="publishing-action">
<input type="submit" id="gform_submit_button_1" name="save" value="Update"
class="btn btn-lg button button-large gform_button button-primary gv-button-update">
<a href="/staff/entry/2/" onclick="history.go(-1); return false;"
class="btn btn-sm button button-small gv-button-cancel">Cancel</a>
<a href="…" onclick="return window.confirm('…')"
class="btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete">Delete</a>
<input type="hidden" name="action" value="update">
</div>
</div>
</form>
</div>
</div>The gv-notice appears after an update. The Delete link appears when the View lets the user delete the entry.
Cancel button behavior
The Cancel link’s onclick goes back as many steps in the browser history as it takes to leave the Edit Entry page: history.go(-1) on the first visit and history.go(-2) after one update. The steps are the number of updates plus one.
Button classes
| Button | Classes |
|---|---|
| Update | btn btn-lg button button-large gform_button button-primary gv-button-update |
| Cancel | btn btn-sm button button-small gv-button-cancel |
| Delete | btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete |
| Previous (forms with pages) | btn btn-lg button button-large gform_button button-primary gv-button-previous |
| Next (forms with pages) | btn btn-lg button button-large gform_button button-primary gv-button-next |
Styling the Buttons on the Edit Entry Page has CSS for these buttons.
Success and error notices
After an update, GravityView prints a notice between the title and the form:
<div class="gv-notice">Entry Updated. <a href="/staff/entry/2/">Return to Entry</a></div>When a field fails validation, the notice has the gv-error class:
<div class="gv-notice gv-error">
<div class="validation_error">There was a problem with your submission. Errors have been highlighted below.</div>
</div>Other errors, such as a user who may not edit the entry, use gv-notice gv-error error.
Gravity Forms classes
Because the form comes from Gravity Forms, the column layout and the CSS classes set on fields in the form editor apply on the Edit Entry page too. Gravity Forms lists the classes it supports in its CSS Ready Classes documentation.
Search Bar widget #
The Search Bar widget appears in a widget zone of any layout. Its fields are arranged in areas, and each area’s Arrange Fields setting places the fields Stacked (vertical) or Side by side (horizontal).
Search layout classes
| Class | Element | When |
|---|---|---|
gv-widget-search | form | Always. |
gv-search-rows | form | Always. |
gv-is-search | form | A search of this View is active, or a search field’s default value is filtering the entries. |
gv-search-widget-area | div | Each area of fields. |
gv-search-horizontal | div.gv-search-widget-area | The area’s Arrange Fields is Side by side (horizontal). A stacked area has no extra class. |
gv-search-columns-{1 to 8} | div.gv-search-widget-area | The area is side by side and Number of Columns is set to a number. |
gv-search-col-submit | div.gv-grid-col-* | The column that holds the Submit Button. |
A Search Bar that has not been saved since GravityView introduced these area settings keeps its old layout class on the <form>: gv-search-horizontal or gv-search-vertical. Saving the View in the View editor removes it.
Class hierarchy
form.gv-widget-search.gv-search-rows
├── h2.gv-search-title.screen-reader-text
├── div.gv-widget-search-general-search.gv-grid
│ ├── div.gv-grid-row
│ │ └── div.gv-grid-col-1-1
│ │ └── div.gv-search-widget-area.gv-search-horizontal
│ │ ├── div.gv-search-box.gv-search-field-text.gv-search-field-search_all
│ │ ├── div.gv-search-box.gv-search-field-select
│ │ └── fieldset.gv-search-box.gv-search-date.gv-search-field-entry_date
│ └── div.gv-grid-row
│ ├── div.gv-grid-col-1-2.gv-search-col-submit
│ │ └── div.gv-search-widget-area
│ │ └── div.gv-search-box.gv-search-box-submit
│ │ ├── a.button.gv-search-clear
│ │ └── input.button.gv-search-button
│ └── div.gv-grid-col-1-2
│ └── div.gv-search-widget-area
│ └── input[type=hidden][name=mode]
├── a#gv-search-advanced-toggle (when there are advanced fields)
└── div#gv-search-advanced.gv-widget-search-advanced-search.gv-grid (when there are advanced fields)Search box types
| Input type | Element and classes |
|---|---|
| Text | div.gv-search-box.gv-search-field-text |
| Search Everything | div.gv-search-box.gv-search-field-text.gv-search-field-search_all |
| Entry ID | div.gv-search-box.gv-search-field-entry_id |
| Select | div.gv-search-box.gv-search-field-select |
| Select (multiple values) | div.gv-search-box.gv-search-field-multiselect |
| Checkbox | fieldset.gv-search-box.gv-search-field-checkbox |
| Checkbox (one choice) | div.gv-search-box.gv-search-field-single_checkbox |
| Radio | fieldset.gv-search-box.gv-search-field-radio |
| Links | div.gv-search-box.gv-search-field-link.gv-search-box-links |
| Date (form field) | fieldset.gv-search-box.gv-search-date |
| Date range (form field) | fieldset.gv-search-box.gv-search-date.gv-search-field-date_range |
| Entry Date | fieldset.gv-search-box.gv-search-date.gv-search-field-entry_date |
| Entry Date range | fieldset.gv-search-box.gv-search-date.gv-search-date-range.gv-search-field-entry_date |
| Number range | fieldset.gv-search-box.gv-search-number.gv-search-number-range |
| Slider | fieldset.gv-search-box.gv-search-number.gv-search-number-slider |
| Chained Selects | fieldset.gv-search-box.gv-search-field-chainedselect |
A date range set to one combined input also has gv-search-date-range--combined. A search field’s Custom CSS Class is added to the same element.
Since GravityView 3.5.0, fields that hold a group of inputs render as a <fieldset> with a <legend> instead of a <div> with a <label>. Leave the element name off your selectors, for example .gv-search-box in place of div.gv-search-box, so your CSS works on both.
Buttons
| Button | Element and classes |
|---|---|
| Search | input.button.gv-search-button, or button.button.gv-search-button when the Submit Button is set to print a <button> |
| Clear | a.button.gv-search-clear |
Advanced search
Fields placed in the advanced area are in div#gv-search-advanced.gv-widget-search-advanced-search, shown and hidden by the a#gv-search-advanced-toggle link before it. The area also has gv-search-advanced--open when one of its fields holds a value from the current search.
HTML example
<form class="gv-widget-search gv-search-rows" role="search"
aria-labelledby="gv-search-label-5 gv-view-5-title"
method="get" action="/staff/#gv-view-5-1"
data-viewid="5" data-gv-search-mode="any">
<h2 id="gv-search-label-5" class="gv-search-title screen-reader-text">Search</h2>
<input type="hidden" name="gv_search_view" value="5">
<div class="gv-widget-search-general-search gv-grid">
<div class="gv-grid-row">
<div class="gv-grid-col-1-1">
<div class="gv-search-widget-area gv-search-horizontal">
<div class="gv-search-box gv-search-field-text gv-search-field-search_all">
<div class="gv-search">
<label for="gv_search_5">Search Entries:</label>
<p><input type="search" name="gv_search" id="gv_search_5" value="" placeholder=""></p>
</div>
</div>
<div class="gv-search-box gv-search-field-select">
<label for="search-box-filter_9">Department</label>
<p>
<select name="filter_9" id="search-box-filter_9">
<option value="" selected="selected">—</option>
<option value="Engineering">Engineering</option>
<option value="Sales">Sales</option>
</select>
</p>
</div>
<fieldset class="gv-search-box gv-search-date gv-search-field-entry_date">
<legend id="gv-entry-date-5-label">Filter by date:</legend>
<div id="gv-entry-date-5" class="gv-date-picker" data-gv-config="…"></div>
</fieldset>
</div>
</div>
</div>
<div class="gv-grid-row">
<div class="gv-grid-col-1-2 gv-search-col-submit">
<div class="gv-search-widget-area">
<div class="gv-search-box gv-search-box-submit">
<a href="/staff/" class="button gv-search-clear">Clear</a>
<input type="submit" class="button gv-search-button" id="gv_search_button_5" value="Search">
</div>
</div>
</div>
<div class="gv-grid-col-1-2">
<div class="gv-search-widget-area">
<input type="hidden" name="mode" value="any">
</div>
</div>
</div>
</div>
</form>The gv_class() function #
The gv_class() function builds the classes of a field’s container. It is a wrapper for GravityView_API::field_class(). The Table, List, Layout Builder and Maps layouts use it for every field. The DIY layout uses it only for fields with a Container Tag, and DataTables body cells do not use it.
How it works
The function puts together the field’s classes in this order:
- The field’s Custom CSS Class. Merge Tags in it are replaced with the entry’s values.
- The field ID class, in the format
gv-field-{form ID}-{field ID}.
Format pattern
gv-field-{form_id}-{field_id}Concrete examples
| Form ID | Field | Class |
|---|---|---|
| 1 | Field 5 | gv-field-1-5 |
| 3 | Field 12 | gv-field-3-12 |
| 1 | Address field 4, City (4.3) | gv-field-1-4.3 |
| 1 | Address field 4, Country (4.6) | gv-field-1-4.6 |
| 1 | Entry link | gv-field-1-entry_link |
| 1 | Date Created | gv-field-1-date_created |
Complex fields (address sub-fields)
Address, Name and other fields with several inputs have sub-fields with a dot in their IDs, and the dot stays in the class. In CSS, escape the dot with a backslash:
.gv-field-1-4\.3 {
font-weight: bold;
}The DIY layout removes the dot instead, so the same field there is .gv-field-1-43.
Cross-form fields (joins)
When a field comes from another form than the View’s main form, as in a View that joins forms, the List and Layout Builder layouts add a second class with the field’s own form:
<div class="gv-field-1-5 gv-field-3-5">
<!-- Field 5 from form 3, in a View of form 1 -->
</div>The class with the View’s form ID, gv-field-1-5 here, also matches field 5 of the main form, so style the joined field with gv-field-3-5.
In the Table layout, the column header has both classes, and the body cells have only the field’s own form class, for example gv-field-3-5.
Merge Tag CSS class conversion
A Merge Tag in a Custom CSS Class is replaced with the field value, and sanitize_html_class() then keeps only its letters, numbers, - and _.
For example, the class {Status:8} on an entry whose Status is “Office Manager” becomes OfficeManager, one class.
Filter hook
gv_class() has no filter of its own. To change a field container’s class, use gravityview/field_output/context/class, which changes the class GravityView prints in the field’s markup:
add_filter( 'gravityview/field_output/context/class', function ( $class, $args, $context ) {
return $class . ' my-custom-class';
}, 10, 3 );In the Table layout, this filter also changes the class of the column headers. It does not reach DIY fields or DataTables body cells.
Grid system #
GravityView has its own grid classes, used by the layouts and the widget zones.
Grid column classes
| Class | Width | What it is |
|---|---|---|
gv-grid | 100% | Grid container |
gv-grid-row | 100% | Grid row |
gv-grid-col-1-1 | 100% | Full-width column |
gv-grid-col-1-2 | 50% | Half-width column |
gv-grid-col-1-3 | 33.33% | One-third column |
gv-grid-col-2-3 | 66.67% | Two-thirds column |
gv-grid-col-1-4 | 25% | Quarter column |
gv-grid-col-1-6 | 16.67% | One-sixth column |
gv-grid-col-1-8 | 12.5% | One-eighth column |
These widths apply to Views with the Legacy theme. Views with a theme such as Vantage lay out the same classes with flex and grid rules in their own stylesheet, which also has gv-grid-col-3-4.
Alignment classes
| Class | Where |
|---|---|
gv-left | The left column of a widget zone, and the left footer column of the List layout |
gv-right | The right column of a widget zone, and the right footer column of the List layout |
Widget zone columns also have left or right, for example gv-grid-col-1-2 left gv-left.
See also Adding Custom CSS classes to fields or widgets.
Responsive behavior
At 480px wide or less, every gv-grid-col-* column is full width. Some layouts stack at wider screens, as Responsive breakpoints shows.
Other styles #
Back link
The single entry page has a back link to the entries. The Table, List, Layout Builder and DataTables layouts print it as a nav:
<nav class="gv-back-link" aria-label="Back to entries">
<a data-viewid="5" href="/staff/">← Go back</a>
</nav>The Maps and DIY layouts print it as <p class="gv-back-link">. Select it with .gv-back-link to style both.
Pagination widget classes
| Widget | Element and classes |
|---|---|
| Page Links | nav.gv-widget-page-links, plus gv-widget-page-links--numbers, --numbers-prev-next or --prev-next-only for the display mode. The links are in ul.page-numbers > li. |
| Page Links: one link | .page-numbers, with current on the current page, and prev, next, first or last on those links |
| Show Pagination Info | div.gv-widget-pagination > p, for example Displaying 1 – 10 of 12 |
| Page Size | div.gv-widget-page-size |
Sort indicator classes
In the Table layout, a column header the visitor can sort by has a sort link with these classes:
| Class | When |
|---|---|
gv-sort | Always |
gv-icon-caret-up-down | The table is not sorted by this column. |
gv-icon-sort-desc | The table is sorted by this column, ascending. |
gv-icon-sort-asc | The table is sorted by this column, descending. |
The icon names the order the next click sorts by.
No results state classes
| Class | What it is |
|---|---|
gv-no-results | The element that holds the “no entries” message |
gv-no-results-text | The message is text. |
gv-no-results-form | The message is a form (No Entries Behavior is Display a Form). |
gv-container-no-results | Added to the View container when there are no entries |
gv-widgets-no-results | Added to the widget zones when there are no entries |
Other utility classes
| Class | What it is |
|---|---|
gv-widgets-header | The widget zone above the entries |
gv-widgets-footer | The widget zone below the entries |
gv-powered-by | The “Powered by GravityView” link, shown when Display “Powered By” Link is on in the GravityKit settings |
screen-reader-text | Text for screen readers only, such as the “Results” heading and the table caption |
Responsive breakpoints
The stylesheet for Views with the Legacy theme uses these SCSS variables:
| Variable | Value |
|---|---|
$mobile-portrait | 320px |
$mobile-landscape | 480px |
$small-tablet | 600px |
$tablet-portrait | 768px |
$tablet-landscape | 1024px |
$desktop | 1280px |
$widescreen | 1400px |
Layouts change at these widths or less:
| Width | What changes |
|---|---|
| 768px | Layout Builder columns stack. |
| 600px | List layout image and description columns stack. |
| 575.98px | Table layout: <thead> and <tfoot> are hidden, and each row shows its cells one per line with their labels. |
| 480px | Every gv-grid-col-* column is full width, and a Search Bar area with a Number of Columns shows one column. |
Views with a theme such as Vantage use 640px, 768px and 1024px instead: multi-column entry grids drop columns at 1024px, 768px and 640px, and Layout Builder columns, List content, the Table layout and the Search Bar stack at 640px.
CSS customization filters #
These filters change the classes and wrappers GravityView prints. The GravityView developer documentation lists every hook with its parameters.
Note: The PHP examples in this section go in your site’s code. See Where to put code samples.
Container filters
gravityview/render/container/class
Changes the classes of the View container.
| Parameter | Type | Description |
|---|---|---|
$css_class | string | The layout’s container classes, then gv-container gv-container-{View ID}, then the classes from Container wrapper that apply. |
$context | \GV\Template_Context | The template context. |
Since: 1.5.4, 2.0
add_filter( 'gravityview/render/container/class', function ( $css_class, $context ) {
return $css_class . ' my-custom-container';
}, 10, 2 );gravityview/view/wrapper_container
Changes the wrapper’s HTML. The {content} placeholder stands for everything inside the wrapper. Return an empty value to print the content with no wrapper.
| Parameter | Type | Description |
|---|---|---|
$wrapper_container | string | The wrapper’s HTML, for example <div id="gv-view-5-1" class="gv-template-table">{content}</div>. |
$anchor_id | string | The wrapper ID, for example gv-view-5-1. |
$view | \GV\View | The View. |
Since: 2.15
This example adds a class to the wrapper and keeps the rest of its HTML:
add_filter( 'gravityview/view/wrapper_container', function ( $wrapper_container, $anchor_id, $view ) {
return str_replace( 'class="', 'class="my-view-wrapper ', $wrapper_container );
}, 10, 3 );Entry row filters
gravityview/template/table/entry/class
Changes the class of each entry row in the Table layout.
| Parameter | Type | Description |
|---|---|---|
$class | string | alt on every other row, empty on the rows between. |
$context | \GV\Template_Context | The template context. |
Since: 2.0.6.1
add_filter( 'gravityview/template/table/entry/class', function ( $class, $context ) {
$entry = $context->entry->as_entry();
if ( ! empty( $entry['is_starred'] ) ) {
$class .= ' gv-featured-entry';
}
return $class;
}, 10, 2 );gravityview/template/table/entry/row/attributes
Changes the HTML attributes of each entry row in the Table layout. GravityView adds data-row after this filter.
| Parameter | Type | Description |
|---|---|---|
$attributes | array | The attributes, with class holding the row’s class. |
$context | \GV\Template_Context | The template context. |
Since: 2.0
gravityview/template/list/entry/class
Changes the class of each entry in the List layout.
| Parameter | Type | Description |
|---|---|---|
$class | string | gv-list-view |
$context | \GV\Template_Context | The template context. |
Since: 2.0.6.1
gravityview/template/layout-builder/entry/class
Changes the class of each entry in the Layout Builder layout.
| Parameter | Type | Description |
|---|---|---|
$class | string | gv-layout-builder-view gv-layout-builder-view--entry gv-grid |
$context | \GV\Template_Context | The template context. |
Since: 2.46.2
gravityview/template/diy/entry/class
Changes the class of each entry in the DIY layout.
| Parameter | Type | Description |
|---|---|---|
$class | string | gv-diy-view |
$context | \GV\Template_Context | The template context. |
gravityview_entry_class (deprecated)
Changes the class of an entry. Use the layout filters above instead.
| Parameter | Type | Description |
|---|---|---|
$class | string | The entry’s class in its layout, for example alt or empty in the Table layout. |
$entry | array | The entry. |
$view | \GravityView_View | The View. |
Field filters
gravityview/field_output/context/{$tag}
Changes the text that replaces a {{ tag }} placeholder in a field’s markup. Use the class tag to change a field’s classes: gravityview/field_output/context/class. It runs only for the tags the field’s markup has.
| Parameter | Type | Description |
|---|---|---|
$value | string | The text that replaces the {{ tag }} placeholder. |
$args | array | The field output arguments. |
$context | \GV\Template_Context | The template context. |
Since: 1.11, 2.0
add_filter( 'gravityview/field_output/context/class', function ( $class, $args, $context ) {
return $class . ' custom-field-class';
}, 10, 3 );gravityview/field_output/pre_html
Changes a field’s HTML template before the placeholders are replaced.
| Parameter | Type | Description |
|---|---|---|
$markup | string | The HTML template. |
$args | array | The field output arguments. |
$context | \GV\Template_Context | The template context. |
Since: 1.11, 2.0
Changes a field’s finished HTML.
| Parameter | Type | Description |
|---|---|---|
$html | string | The field’s HTML. |
$args | array | The field output arguments. |
$context | \GV\Template_Context | The template context. |
gravityview/field_output/args (deprecated)
Changes the arguments before a field’s output is built. Use gravityview/template/field_output/context instead. To change a field’s classes or value rather than its markup, gravityview/field_output/context/{$tag} above is usually the better hook. To change the finished HTML, use gravityview/field_output/html.
gravityview_field_output (deprecated)
Changes a field’s finished HTML. Use gravityview/field_output/html instead.
Search filters
Changes the classes of the Search Bar’s <form>, after gv-widget-search. GravityView adds gv-is-search after this filter.
| Parameter | Type | Description |
|---|---|---|
$search_class | string | gv-search-rows, plus the widget’s custom class. A Search Bar with the old layout setting starts with gv-search-horizontal or gv-search-vertical. |
add_filter( 'gravityview_search_class', function ( $search_class ) {
return $search_class . ' custom-search-class';
} );gk/gravityview/search/widget/grid/column-class
Changes the class of each column in the Search Bar’s grid.
| Parameter | Type | Description |
|---|---|---|
$column_class | string | The column class, for example gv-grid-col-1-2 gv-search-col-submit. |
$col | string | The column specification. |
$areas | array | The areas in the column. |
$search_fields | \GV\Search\Search_Field_Collection | The search fields. |
Since: 2.44
DIY-specific filters
gravityview-diy/container
Changes the tag of the DIY View container. The default is div. Return false to print the entries with no container.
| Parameter | Type | Description |
|---|---|---|
$tag | string | div |
$gravityview | \GV\Template_Context | The template context. |
add_filter( 'gravityview-diy/container', function ( $tag ) {
return 'section';
} );To remove the container, pass WordPress’ __return_false as the callback: add_filter( 'gravityview-diy/container', '__return_false' );.
gravityview-diy/wrap/multiple and gravityview-diy/wrap/single
Turn the gv-diy-view wrapper around each entry on or off, on the multiple entries page and the single entry page. The default is true.
gravityview-diy/container-tags
Changes the choices of the Container Tag setting.
| Parameter | Type | Description |
|---|---|---|
$tags | array | Tag names and their labels: none, div, blockquote, pre, h1 to h4 and p, plus address for Address fields. |
$input_type | string | The field’s input type. |
$context | string | directory or single. |
Widget zone filters
gravityview/widgets/wrapper_css_class
Changes the classes of a widget zone, the gv-widgets-header or gv-widgets-footer element.
| Parameter | Type | Description |
|---|---|---|
$css_class | string | gv-grid gv-widgets-{zone}, plus gv-widgets-no-results when there are no entries and gv-hidden when the View is hidden. |
$zone | string | header or footer. |
$widgets | array | The widgets in the zone. |
Since: 1.16.2
add_filter( 'gravityview/widgets/wrapper_css_class', function ( $css_class, $zone, $widgets ) {
if ( 'header' === $zone ) {
$css_class .= ' my-custom-header';
}
return $css_class;
}, 10, 3 );DataTables table filter
gravityview_datatables_table_class
Changes the classes of the DataTables <table> element. It passes the classes as one string, display dataTable by default. Other DataTables settings add to it, such as nowrap when Responsive is on. GravityView prints gv-datatables before the filtered classes.
| Parameter | Type | Description |
|---|---|---|
$classes | string | The table’s classes, separated by spaces. |
add_filter( 'gravityview_datatables_table_class', function ( $classes ) {
return $classes . ' my-custom-table-class';
} );