Skip Navigation

[Resolved] cannot delete query in view

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/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 1 year ago.

Assisted by: Waqar.

Author
Posts
#2673265

I have the same problem as in this topic:
https://toolset.com/forums/topic/cannot-delete-custom-fields-filter-under-query-filter/

My view is created with the block editor.

Waqar's suggestion was: "To avoid a situation like this, it is a good practice to use a separate content template in views where there are a lot of query filters, loop item content, CSS, and/or JS scripts involved. This way, the serialized data in a custom field meta key '_wpv_settings' for the view will remain limited and the content of the loop item, additional CSS and JS scripts will be saved in the separate custom field meta key records, with the content template and not the view itself.
(when using a content template for the view's loop item, be sure to include custom CSS and scripts in the tabs below the loop item content template editor and not the ones under the "Search and Pagination" and the "Loop Editor" sections )"

Can you help me how to implement this solution?

#2673287

Hi,

Thank you for contacting us and I'd be happy to assist.

If you're facing the same challenge as the other ticket and using the blocks-based view, you can follow these steps:

a). You'll create a blocks-based view, as you normally would, but without adding any content/blocks inside the 'View Loop' block.

b). Next, you'll create a content template that will have the content/blocks that you'd like to show inside the individual loop item or results of the view.

c). Any custom CSS or JS code that you may have to include in this view's output, will be added in the respective CSS/JS fields, available on the content template editor screen and not on the view editor.

d). Lastly, in the 'View Loop' block of the view created in step 'a', you can load this content template through the 'Content Template' block.

I hope this helps and please let me know if you need further assistance.

regards,
Waqar

#2673307
Screenshot 1 2023-12-13.png
Screenshot 2 2023-12-13.png

Thank you Waqar,

I have created a content template (Step b) and not set Usage to the existing custom post type or any other post. So No Post types/Taxonomies assigned (screenshot 1)

But then in the sidebar I do not see and cannot select the custom fields that I want to show. (screenshot 2)

#2674199

Thanks for writing back.

Your observation is correct and the custom fields are shown only from the posts that is set as the 'View with' field at the top of the content template editor screen.
( this selected post is used to show the preview data on the content template edit screen )

To overcome this, you can temporarily, set this content template's usage setting to be assigned to the target post type. And then select any post from that post type, in the 'View with' field at the top.

After that, you'll be able to select the desired custom field group and fields, in the source settings of the blocks used in the content template.

Once the content of the template is ready, you can set the actual content template, as the post type's assigned content template. This will automatically unassigned this new template from that post type.

#2675137

Since I also use frontend search, it seems too complicated for me to work with a content template in a view. I will leave it as it is for now.
Thanks anyway