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>
</div>
</div>
I don't understand why some nbsp character are showing up in the middle. Any idea?
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
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.
Thanks a lot Waqar! Have a great day