Skip Navigation

[Resolved] Adding headers/titles to table of results

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to add headers to table generated using views

Solution:
you should add your header code outside the tag and it will not repeat the headers and you will see header only once.

You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/adding-headers-titles-to-table-of-results/#post-777899

Relevant Documentation:
https://toolset.com/documentation/user-guides/view-layouts-101/#table

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by leilaG 6 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#777435

We would like to add header/titles to the results of this page - hidden link

Example:

Job Title Location Category

When we add the code in views, it repeats on every row of results, what's the best way to do this?

#777899

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - its simple, you should add your header code outside the <loop> tag and it will not repeat the headers and you will see header only once.

For example:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<table width="100%">
		<thead>
			<tr>
				<th>Job Title</th>
                                <th>Location</th>
                                <th>Category</th>
		</tr>
		</thead>
		<tbody class="wpv-loop js-wpv-loop">
		<wpv-loop>
			<tr>
				<td> field1 </td>
				<td>ield2 </td>
				<td>ield3</td>
			</tr>
		</wpv-loop>
		</tbody>
	</table>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

More info:
=> https://toolset.com/documentation/user-guides/view-layouts-101/#table

#779092

Perfect! Thank you