Skip Navigation

[Resolved] display data in 2 columns

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

Problem:

I need to return a long list of related services on the projects page. I'd like that to be dynamic and return a list of 20 and put 10 in one column and 10 in another.

Solution:

It is possible within Views shortcode [wpv-item index=split2], you can use it to find the middle item, and break the result into two columns, for example, with Bootstrap:

https://toolset.com/forums/topic/display-data-in-2-columns/#post-1232595

Relevant Documentation:

https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-item

This support ticket is created 5 years, 7 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by JamesK4399 5 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#1232483

I'm wondering if toolset supports showing data split between 2 columns. There are a number of places in the layout tool that talk about grids but I haven't found what I'm trying to do.

I need to return a long list of related services on the projects page. I'd like that to be dynamic and return a list of 20 and put 10 in one column and 10 in another.

I faked it by using the same related services view, setting the limit to 10 and adding an offset of 11 to the 2nd call of the view.

It works but I'm worried there may be some unintended results and wouldn't want to miss using the function if it exists.

Thanks,
Jim

#1232595

Dear Jim,

It is possible within Views shortcode [wpv-item index=split2], you can use it to find the middle item, and break the result into two columns, for example, with Bootstrap:

...
	<div class="row ">
      <div class="col-sm-6">
	<wpv-loop>
		[wpv-item index=split2]
        	[wpv-post-link]<br />
			</div><div class="col-sm-6">
		[wpv-item index=other]
			[wpv-post-link]<br />
	</wpv-loop>
      </div>
	</div>
...

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-item
index=split2 will target the item that falls in the middle of the number of displayed items.

#1232958

That worked really well! Thank you, Luo Yang

#1232960

My issue is resolved now. Thank you!