Skip Navigation

[Resolved] I want to put an image into the first item in a view using new view block

This support ticket is created 4 years, 4 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by katieS 4 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#1723707

Tell us what you are trying to do?
I am using Toolset blocks and I want to create a view where the first item in the loop is replaced by an image. I used to be able to do this using Classic Views but I don't want to use that as I want all my views to behave the same when responding.
Is there any documentation that you are following?

Is there a similar example that we can see?the attached image is what I am trying to achieve

What is the link to your site?hidden link

#1723813

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2020-07-31 at 14.49.57.png

Hi Katie

With Blocks you don't have access to the wpv-item shortcodes where you could specify index numbers in the same way that you did in legacy Views.

But you can use a Conditional block that checks the current loop index number before outputting anything, see the screenshot.

You should be able to use that in your output section to show something specific for the first loop item.

#1723891

Thank you for that - a useful condition!
I have managed to get the image for the first item but struggling to show the content template i have for the rest of the view.

#1723897

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

In my screenshot you should be able to see a NOT toggle in the top left.

The best way to achieve something like IF... ELSE... with the conditional block is to use the exact same condition and in the second instance apply the NOT toggle, so checking that the same condition is not true.

So two conditional blocks, one with what you want for the first loop item, and the second for what you want for all other loop items.

#1723901

My issue is resolved now. Thank you!