Skip Navigation

[Resolved] Remove extra space

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

Last updated by melanieG-2 2 years, 5 months ago.

Assisted by: Waqar.

Author
Posts
#2203127
Capture d’écran, le 2021-10-22 à 14.11.33.png

I'm using a flex box to display a view and some extra space is added. I have no idea why.

This is the page where I'm using the view: hidden link

This is the code of my view:
<div class="flex-container">
<div class="inner-box">
<h3>[wpv-post-title]</h3>
<p class="business-category">[wpv-post-taxonomy type="business-category"]</p>
<p class="website">[types field='website-url' title='Website' target='_blank'][/types]</p>
<p class="phone-number">[types field="phone-number"][/types]</p>
<a href="[types field='website-url' output='raw'][/types]" target="_blank" rel="noopener"><span class="link"></span></a>
</div>
</div>

I don't understand why some nbsp character are showing up in the middle. Any idea?

#2204581

Waqar
Supporter

Languages: English (English )

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

Hi,

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

From looking into the page's source code, I noticed that in the view's content template ( 'loop-item-in-e-cards-with-filters' ), some PHP code is included in the JS editor:


add_filter('et_pb_text_shortcode_output', 'dbc_replace_nbsp_with_spaces');
if (!function_exists('dbc_replace_nbsp_with_spaces')) {
function dbc_replace_nbsp_with_spaces($content) {
$nbsp = '(&'.'nbsp;|\xc2\xa0)';
$not_preceded_by = '<p>';
$non_newline_nbsp = '(?<!'.$not_preceded_by.')'.$nbsp;
return preg_replace("/{$non_newline_nbsp}/", ' ', $content);
}
}

The JS editor should only include the script code and not the PHP code, so please remove this code and then check the view again.

If the issue still persists, you're welcome to share temporary admin login details, so that I can see how this view is set up in the admin area.

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

regards,
Waqar

#2207955

Waqar
Supporter

Languages: English (English )

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

Thank you for sharing the admin access and I apologize for the delay in getting back on this.

During troubleshooting, I was able to remove those extra spaces from the view's loop item content, following these steps:

1. I removed all the extra spaces and line breaks from the view's content editor sections, especially around the loop item's content.
( screenshot: hidden link )

2. In the view's content template shortcode "wpv-post-body", included the suppress_filters="true" attribute, so that the content filters from the theme and/or third-party plugins don't affect this template's output:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body )


[wpv-post-body view_template="loop-item-in-e-cards-with-filters" suppress_filters="true"]

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

#2208135

Thanks a lot Waqar! Have a great day

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