Skip Navigation

[Closed] Using Toolset Block, like to divide loop with diveder

This support ticket is created 3 years, 11 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.

Our next available supporter will start replying to tickets in about 7.17 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by Christian Cox 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1869917

I using block editor to edit my Content templates and i have a view that uses a CPT.
the grid is set to 3 columns. and all is looping fine.
I sort by a primary value from a CF, and thats working perfekt.
My sorting is
Monday, tuesday, wednesday, thursday, friday.
Every post is listed as it should and sorting works.
it is listed
Monday monday tuesday
tuesday tuesday wednesday...etc

But now i like to divide the sorting.
So all monday is seen like this
Monday monday monday
<HR>
Tuesday tuesday tuesday
<HR>
wednesday...etc...

how can i do this ?
Whn i look at the css there is nothing i can call and use (in my knowledgement)

thank you

#1870879

Hello, unfortunately there is no simple way to group results in a View by some custom field value. It sounds like that is what you really need here. The simplest solution is probably to create one View for each "day", and filter each View by that custom field value:
- View 1: filtered by custom field = Monday
- View 2: filtered by custom field = Tuesday
- View 3: filtered by custom field = Wednesday
- and so on. Place all the Views in your template, and insert HR or divider blocks between each View.

Will this work in your situation, or is something more complex needed here?

#1870899

Hi Christian,
This was my first approach. But, i need the search and filter to work as well. Not one search per View, one search that search on all View is not possible?

#1871781

Unfortunately the search filters added to one View in the Block Editor are not designed to directly influence the results of another View included in the same Block Editor design. There are some hacky ways around this with many limitations, and I don't recommend them. Instead, I would explore a CSS solution. These links show how you can use a CSS selector to target the first element with a specific CSS class by overriding subsequent items with that CSS class using ~:
https://stackoverflow.com/questions/2717480/css-selector-for-first-element-with-class
https://philna.sh/blog/2018/03/18/css-first-of-class/

In the Loop of the View, you could use the value of the custom field to generate a CSS classname in a custom HTML block, like this:

<div class="day-[types field='your-day-field-slug' output='raw'][/types]">

Then you would need to close that div in another custom HTML block, after the other content in the loop:

</div>

That would generate content like:
div.day-monday
div.day-monday
div.day-tuesday
div.day-tuesday
div.day-tuesday
div.day-tuesday
div.day-wednesday
div.day-wednesday
... and so on.

Then you could use CSS to add a top border, or use CSS ::before to add some other content above that element.

#1872833

Thanks! But i cant find how i can add a CF to a class ?
when i add this in the class field i got 2 classes from "day-[types field='summitday' output='raw'][/types] " 😀
first class is Day- and next will be "field=summitday 😀
I Belive i do it wrong 😉

i also had a thought of do like this, but that was no good approach. mThe thought was to "interrupt" the grid to start over.
Yes, No - my css-skills is NOT as good as i would like it to be 🙂

.tb-grid-column:nth-child(6)::after,
.tb-grid-column:nth-child(12)::after,
.tb-grid-column:nth-child(18)::after,
.tb-grid-column:nth-child(24)::after,
.tb-grid-column:nth-child(30)::after,
.tb-grid-column:nth-child(36)::after {
content :'</div><div class="tb-grid">';
}

EDIT : GOT it, now i added a "custom html field" and now i got it like you described.
now next step...

#1874619

Okay let me know what you need from us. Custom CSS programming is a bit outside the scope of support we offer here. I can try to point you to some examples like the links I provided earlier, or I can show you how to add your own custom CSS classes in the Block Editor or a custom shortcode, or make recommendations based on what I see on the front-end of your site if you provide a URL.

The topic ‘[Closed] Using Toolset Block, like to divide loop with diveder’ is closed to new replies.