Skip Navigation

[Resolved] Need a view to output text for html data attribute without spaces…

This support ticket is created 2 years, 8 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
- 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 2 replies, has 2 voices.

Last updated by shawnW-3 2 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#2152951

Tell us what you are trying to do?
I'm working on an application to filter products with jQuery. This will require a line like:

<div class="uk-width-1-6 uk-text-center dataelements" data-tags="[wpv-view name='product-title-and-related-product-types-product-guide-view']">

The view name in that code loops

[wpv-post-slug] [wpv-post-slug item="@product-product-type.parent"]

without out any html and with "Disable the wrapping DIV around the View" checked.

However it's returning:





	
	
	
		grills installation-accessories
	
	
	
	


With unwanted spaces/returns.

After thorough testing in my JS, I believe this is what's keeping the function from working properly. Could be wrong, but it's what everything is pointing to.

Is there a way to eliminate these spaces so that I'm just getting "grills installation-accessories"?

Is there any documentation that you are following?
I've looked, but it's a hard thing to search for specifically

Is there a similar example that we can see?
Not that I can think of outside of stating the intended result is, for example:

<div class="uk-width-1-6 uk-text-center dataelements" data-tags="grills installation-accessories">

What is the link to your site?
hidden link

#2153427

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

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

I tried to view the page that you've shared, but it shows the "403 Forbidden" error.

To remove all the extra spaces and characters from the view's output, you can follow these steps:

1. From the view's "Output Editor", remove the shortcode "[wpv-filter-meta-html]".
( it will remove any content or spaces added in the "Search and Pagination" section )

2. In the view's "Loop Editor" make sure that no extra lines or line breaks are used and all the content is added in the same line, without spaces.

For example:


[wpv-layout-start][wpv-items-found]<!-- wpv-loop-start --><wpv-loop>[wpv-post-slug] [wpv-post-slug item="@product-product-type.parent"]</wpv-loop><!-- wpv-loop-end -->[/wpv-items-found][wpv-no-items-found][/wpv-no-items-found][wpv-layout-end]

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

regards,
Waqar

#2153707

Brilliant! Should have thought of those two things! My issue is resolved now. Thank you!

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