Hide title of Flex Block when no posts are found.

Posted in: Newspaper
Post count: 144

We’re using a Flex Block 1 on a taxonomy template and are trying to hide the block title when no posts are returned. For example, our taxonomy template includes a “Company Profiles” block that’s configured to display profiles tied both to the current taxonomy term and to the Company Profiles category.

Some taxonomy terms have associated profiles and some don’t. For the ones that don’t, the template still shows the “Company Profiles” header with an empty section underneath.

Has anyone found a good way to conditionally hide the block title when the query returns zero posts?

Post count: 35449

Hi,
Unfortunately, there is no option for this. What you can do is to use a class on that flex block and with custom JS to check if there is or not content, if not, to set display none on that class.

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.