Skip Navigation

[Resolved] Hide content if view has no results

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 10 replies, has 3 voices.

Last updated by Mateus Getulio 10 months, 3 weeks ago.

Assisted by: Mateus Getulio.

Author
Posts
#2607937

Hello,
I have a Repeatable Field Groups that I display using a block view. I would like nothing to show if there is no content. I tried using conditional block but it doesn't work...
The example would be that I have a list that produces some results (Title: results). When there are no results it looks like this:
Title: "There is no results".
I would like nothing to be displayed as I use in other non-view cases with the conditional block... how would it be done with view?
Thanks!

#2608277

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Thanks for your contact!

If you're using the legacy Views, you can delete the text directly in the Loop Output. Please check the 'no items found' message here: https://toolset.com/wp-content/uploads/2012/04/layout-html-toolbar-300x13011.png. It can be deleted and then nothing will be displayed when there are no results for the View.

If this does not apply for you, we can also hide the message through CSS. For example:

#wpv-view-layout-6784 {

visibility: hidden;

}

Where '6784' is the ID of the View that we're trying to hide. You can inspect the 'no items found' message in your frontend in order to check what is the ID of your View.

Please give it a try and let us know how it goes. Thank you.

Best,
Mateus.

#2609765

Hi Mateus,

I'm using block views, not legacy Views... on a repeteable field grup.

I think I didn't explain myself well... I have a block view (on a repeteable field grup) with a title. When there are no results, the title is shown... I want to know how to do it so that when there are no results, nothing is shown, not even the title. Conditional block doesn't work... An example (title and results):

Featured artists:
Bob Dylan
John Lennon
Marilyn Monroe

When there are no results, the title "Featured artists" show, like this (only title):

Featured artists:

...and I don't even want the title to show...

Let me know. Thanks!

#2609873

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Thanks for your reply.

Could you please show us in which page the View and Conditional blocks are located? Also, I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://toolset.com/privacy-policy-and-gdpr-compliance/#data-shared-with-our-support
**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.

#2610259

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello again,

I have double-checked the problem, but so far I haven't been able to find a fix. I asked my colleagues to take a look to see if there's anything I'm missing.

I'll come back here as soon as one of them answers me (which shouldn't take long). Thank you in advance for your patience!

Regards,
Mateus.

#2610535

Nigel
Supporter

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

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

Hi there

If you are using the block editor for your Views then you should follow the steps outlined in the documentation here: https://toolset.com/course-lesson/creating-a-custom-search/#hide-the-search-results-until-the-first-search

Could you please review that and try to apply the same to your site?

#2611327

Hi Nigel,
it doesn't work...
More ideas?
Thanks!

#2611705

Nigel
Supporter

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

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

Screenshot 2023-05-31 at 16.05.13.png
Screenshot 2023-05-31 at 16.04.51.png

Hi Mar

Sorry, I misunderstood what you needed given what Mateus shared with me, I thought a custom search was involved.

What you want is fairly straightforward using the legacy Views editor, but difficult with the View block, which doesn't have quite the same flexibility in terms of where you add content.

Specifically, you have a heading (e.g. "Artistes destacats:") that needs to appear before the loop of results, but needs to be part of the same section as the results so that if there are no results found then the no results found text can be used (and you can simply have that as an empty string).

Unlike in the legacy editor, you can't place something in the results but before the loop itself.

As an alternative, you can move your static heading inside the loop section of the View, at the top, but include it within a conditional block that checks to see if this if the first iteration of the results.

So if there are some results, just before the first result your heading will be output.

If there are no results you want to output nothing (when you have the View Loop block highlighted, you can delete the text in the Loop Template settings for the No items found text).

Regarding where to add the conditional block with your static heading, you want to add it as the first block within the loop editor, as shown in my screenshot (which has a heading block outputting "View results"). The second screenshot shows the condition you are checking.

Does that make sense?

#2612621

Hi Nigel,
it makes sense but it doesn't work in a view with repeatable fields... I'll have to do it with legacy Views editor.
Thank you!

#2612657

Hi Nigel,

Can I put a conditional in the legacy view if it's a repeatable field? I haven't managed to do it...

Thanks!

#2612749

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello again,

Thanks for your return.

For this, you'll need to apply a workaround similar to what my colleagues described in the following threads:

https://toolset.com/forums/topic/using-repeatable-groups-in-conditional-field-display/
https://toolset.com/forums/topic/conditional-on-amount-of-repeatable-fields/

I kindly ask you to check if the suggested options work for you.

Note: the possible solutions provided are to be used just as informational ones. Please remember that custom coding is out of the scope of our support, so we can't create, debug or modify code for you and it's your responsibility to maintain it. We hope the one we used as an example could point you in the right direction. Please check our support policy for more info: https://toolset.com/toolset-support-policy/

Thanks for your understanding. If you need anything else don't hesitate to contact us.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.